Few-shot prompting: ครบทุกตัวอย่าง!
มาถึงบทสรุปแล้ว! ลองเพิ่มตัวอย่างสุดท้าย Comfortable, but not very pretty = 2 ลงในพรอมต์ แล้วดูว่าผลลัพธ์จะดีขึ้นอีกหรือไม่
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
การใช้งาน DeepSeek ใน Python
คำแนะนำการฝึกหัด
- เพิ่มตัวอย่าง
Comfortable, but not very pretty = 2ลงในพรอมต์ แล้วรันคำขออีกครั้ง
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
client = OpenAI(api_key="", base_url="https://api.together.xyz/v1")
# Add the final example
prompt = """Classify sentiment as 1-5 (negative to positive). Return no explanations:
1. ____
2. Love these! = 5
3. Unbelievably good! =
4. Shoes fell apart on the second use. =
5. The shoes look nice, but they aren't very comfortable. =
6. 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)