फ्यू-शॉट प्रॉम्प्टिंग: सारे उदाहरण!
अब फिनाले के लिए! प्रॉम्प्ट में Comfortable, but not very pretty = 2 वाला उदाहरण जोड़कर देखें। क्योंकि यह उदाहरण अधिक मध्यम है, यह मॉडल को दूसरे-आखिरी रिव्यू, जो समस्या दे रहा था, में मदद कर सकता है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
OpenAI API के साथ काम करना
अभ्यास निर्देश
- प्रॉम्प्ट में
Comfortable, but not very pretty = 2उदाहरण जोड़ें और रिक्वेस्ट दोबारा चलाएँ.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
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)