Few-shot prompting: tất cả ví dụ!
Giờ là màn cuối! Hãy thử thêm ví dụ cuối cùng Comfortable, but not very pretty = 2 vào prompt để xem có cải thiện thêm không.
Bài tập này là một phần của khóa học
Làm việc với DeepSeek bằng Python
Hướng dẫn bài tập
- Thêm ví dụ
Comfortable, but not very pretty = 2vào prompt và chạy lại yêu cầu.
Bài tập tương tác thực hành trực tiếp
Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.
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-V3", messages=[{"role": "user", "content": prompt}], max_tokens=150)
print(response.choices[0].message.content)