Introduction & Scenario Overview 00:05
- The presenters introduce themselves as part of Anthropic's applied AI team and set the agenda to cover prompt engineering best practices using a real-world example.
- The session will involve building a prompt to analyze images and make factual judgments, specifically for a Swedish car insurance claim scenario.
- The scenario involves a car accident report form and a human-drawn sketch, both of which Claude (the AI model) will analyze to determine fault.
Initial Prompting & Observations 02:07
- The first attempt at prompting Claude is minimal, resulting in incorrect context detection (Claude assumes a skiing accident instead of a car accident).
- The initial lack of explicit scenario context leads Claude to make reasonable but incorrect guesses.
- Prompt engineering is highlighted as iterative and empirical—iterations are necessary to refine the prompt based on observed outputs.
Structure of a Great Prompt 03:58
- Best practices for prompt structure include:
- Setting a clear task description.
- Providing relevant content (e.g., forms, images).
- Supplying detailed step-by-step instructions.
- Including examples when possible.
- Concluding with a reminder or summary of key points.
- When working with APIs, a single well-crafted prompt is preferable to conversational back-and-forth.
Task and Tone Context 05:31
- Adding explicit task context helps guide the AI to the right problem space (e.g., specifying car accident, not skiing).
- Including tone instructions encourages factual, confident assessments and discourages guessing when information is unclear.
- Showing how revised prompts with clearer context lead Claude to more relevant responses, but still with some information missing for full confidence.
Providing Static Data & Prompt Organization 08:44
- Details that do not change (like the structure of the accident form) are recommended to be placed in the system prompt for efficiency and clarity.
- Using delimiters like XML tags or Markdown helps structure the information for Claude; XML is particularly favored for clarity and reference.
- Organization within the prompt aids Claude’s comprehension, leading to more accurate and confident outputs.
Iterative Enhancements & Concrete Examples 13:07
- Including specific examples (few-shot learning) in the prompt/system prompt can significantly improve Claude’s accuracy, especially for tricky or ambiguous cases.
- Examples can be textual descriptions or encoded images, coupled with the expected analysis or conclusion.
- Reiterates the empirical, iterative approach to refining prompts by identifying where the model struggles and incorporating relevant examples.
Use of Conversation History & Reminders 15:01
- When relevant, past conversation history can be included in prompts to provide richer context, though not needed for the current backend-focused demo.
- Explicit reminders and guidelines at the end of the prompt help prevent hallucination and ensure Claude only answers when confident.
- Guidelines can instruct Claude to cite evidence directly from the input data for any factual claims.
Step-by-Step Reasoning & Output Formatting 17:10
- Detailed step-by-step task lists improve Claude’s reasoning by specifying the order and method of analysis (e.g., examine the form first, then the sketch).
- The prompt can be tailored to produce outputs in desired structures (e.g., XML tags, JSON), aiding downstream processing and integration with other systems.
- By iterating on task instructions and output format requirements, the model output becomes more succinct, accurate, and directly usable.
Advanced Formatting & Extended Thinking Features 22:18
- Output formatting instructions (like wrapping verdicts in specified tags) are essential for integration and for filtering only required results.
- Prefilled response structures (e.g., beginning output with a certain tag or JSON format) further ensure model compliance with required formats.
- Advanced model versions (like Claude 3.7 and 4) support extended thinking modes, allowing the model to show its reasoning in scratchpads—helpful for both engineering and debugging.
Conclusion & Next Steps 24:17
- Emphasis on the continuous, iterative nature of prompt engineering and the value of structured, explicit communication with the AI model.
- Attendees are invited to further sessions and live demos, as well as to engage with the presenters for questions outside of the recorded session.