CommencerCommencez gratuitement

One-shot prompting: will it be enough?

As you saw, there's room for improvement in your initial prompt. Try adding an example, Love these! = 5, and including = after each review to see if you can get more consistent formatting and more accurate numbers.

Cet exercice fait partie du cours

<cours>Working with DeepSeek in Python</cours>
Voir le cours

Instructions de l’exercice

  • Add the example Love these! = 5 to the start of the prompt, and add = after each review in the prompt to indicate how the result should be formatted.

Exercice interactif pratique

Essayez cet exercice en complétant ce code d’exemple.

client = OpenAI(api_key="", base_url="https://api.together.xyz/v1")

# Add the example to the prompt
prompt = """Classify sentiment as 1-5 (negative to positive). Return no explanations:
1. ____
2. Unbelievably good! ____
3. Shoes fell apart on the second use. ____
4. The shoes look nice, but they aren't very comfortable. ____
5. Can't wait to show them off! ____"""

response = client.chat.completions.create(model="deepseek-ai/DeepSeek-V4-Pro", messages=[{"role": "user", "content": prompt}], max_tokens=500)
print(response.choices[0].message.content)
Modifier et exécuter le code