वन-शॉट प्रॉम्प्टिंग: क्या यह काफ़ी होगी?
जैसा आपने देखा, आपके शुरुआती प्रॉम्प्ट में सुधार की गुंजाइश है. एक उदाहरण Love these! = 5 जोड़कर देखें, और हर रिव्यू के बाद = शामिल करें ताकि आपको ज़्यादा सुसंगत फ़ॉर्मेटिंग और अधिक सटीक संख्याएँ मिलें.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में DeepSeek के साथ काम करना
अभ्यास निर्देश
- प्रॉम्प्ट की शुरुआत में उदाहरण
Love these! = 5जोड़ें, और परिणाम किस फ़ॉर्मेट में होना चाहिए यह दर्शाने के लिए प्रॉम्प्ट में हर रिव्यू के बाद=जोड़ें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
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)