Prompt Engineering
Crafting effective prompts is crucial for getting the best results from language models.
Recommendations:
- Be specific and clear - Provide detailed instructions and specify the desired format.
- Use system messages effectively - Define the assistant’s role and constraints in the system message.
- Include examples - For complex tasks, include examples of desired outputs.
- Structure matters - Organize information logically, with the most important details first.
Example: Well-Structured Prompt
Section titled “Example: Well-Structured Prompt”response = openai.ChatCompletion.create( model="deepseek-ai/DeepSeek-R1", messages=[ {"role": "system", "content": "You are a data analysis assistant that provides insights in a structured format."}, {"role": "user", "content": """ Analyze the following quarterly sales data and provide: 1. Key trends 2. Comparison to previous quarter 3. Recommendations for next quarter
DATA: Q3 2023: $1.2M (North: $400K, South: $350K, East: $250K, West: $200K) Q2 2023: $1.0M (North: $300K, South: $300K, East: $200K, West: $200K) """} ], temperature=0.2)