Az örnekli istem: tüm örnekler!
Finale zamanı! İsteme Comfortable, but not very pretty = 2 örneğini eklemeyi dene. Bu örnek daha ılımlı olduğundan, modelin sorunlu sondan bir önceki değerlendirmede daha iyi performans göstermesine yardımcı olabilir.
Bu egzersiz
OpenAI API ile Çalışmak
kursunun bir parçasıdırEgzersiz talimatları
Comfortable, but not very pretty = 2örneğini isteme ekle ve isteği tekrar çalıştır.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
client = OpenAI(api_key="")
# Add the final example
prompt = """Classify sentiment as 1-5 (negative to positive):
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="gpt-4o-mini", messages=[{"role": "user", "content": prompt}], max_completion_tokens=100)
print(response.choices[0].message.content)