शुरू करेंमुफ़्त में शुरू करें

और अधिक assistant संदेश!

अपने पिछले संदेशों को बढ़ाइए और अतिरिक्त उदाहरण जोड़िए, जिन्हें example1, response1, example2, response2, example3, और response3 के रूप में स्टोर किया गया है।

देखते हैं क्या हम इस मॉडल से मनचाहे फ़ॉर्मेट में आउटपुट दिलवा पाते हैं!

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में DeepSeek के साथ काम करना

पाठ्यक्रम देखें

अभ्यास निर्देश

  • अपने पिछले संदेशों का विस्तार करें और दूसरे देशों के अतिरिक्त उदाहरण शामिल करें, जो example1, response1, example2, response2, example3, और response3 के रूप में स्टोर हैं।

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

client = OpenAI(api_key="", base_url="https://api.together.xyz/v1")

response = client.chat.completions.create(
   model="deepseek-ai/DeepSeek-V4-Pro",
   # Add in the extra examples and responses
   messages=[
       {"role": "system", "content": "You are a helpful Geography tutor that generates concise, one-sentence summaries for different countries."},
       {"role": "user", "content": "Give me a quick summary of Portugal."},
       {"role": "assistant", "content": "Portugal is a country in Europe that borders Spain. The capital city is Lisboa."},
       {"role": "user", "content": ____},
       {"role": "assistant", "content": ____},
       {"role": "user", "content": ____},
       {"role": "assistant", "content": ____},
       {"role": "user", "content": ____},
       {"role": "assistant", "content": ____},
       {"role": "user", "content": "Give me a quick summary of Greece."}
   ]
)

print(response.choices[0].message.content)
कोड संपादित करें और चलाएँ