DeepSeek के साथ तर्क करना

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

James Chapman

AI Curriculum Lead, DataCamp

चैट आइकन

  • अगले शब्दों की भविष्यवाणी करें
  • ✅ व्यापक उपयोग-केस
  • ❌ गहरे मल्टी-स्टेप कार्यों में कठिनाई

तर्क आइकन

  • जटिल कार्यों को उप-कार्यों में बाँटें
  • ✅ जटिल कार्यों पर बेहतर प्रदर्शन
  • ❌ धीमा और अधिक महँगा
Python में DeepSeek के साथ काम करना

तर्क और गणित

एक ट्रेन 60 miles दूरी 1.5 hours में तय करती है। यदि वही रफ़्तार बनी रहे, तो 4 hours में कितनी दूर जाएगी, और यदि 2:15 PM पर निकले तो कब पहुँचेगी?

पटरी पर चलती ट्रेन।

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

तर्क और गणित

एक ट्रेन 60 miles दूरी 1.5 hours में तय करती है। यदि वही रफ़्तार बनी रहे, तो 4 hours में कितनी दूर जाएगी, और यदि 2:15 PM पर निकले तो कब पहुँचेगी?

  1. गति निकालें (60 ÷ 1.5 = 40 mph)

  2. दूरी के लिए 4 hours से गुणा करें (40 × 4 = 160 miles)

  3. प्रस्थान समय में 4 hours जोड़ें (2:15 PM + 4 hours = 6:15 PM)

  4. रिटर्न: "160 miles, 6:15 PM पर आगमन"

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

तर्क पर तर्क

सोचना, करना, और ज्ञान अपडेट करने का उच्च-स्तरीय तर्क वर्कफ़्लो।

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

डिफ़ॉल्ट रूप से reasoning ऑन है

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4.1-Flash",
    messages=[{"role": "user", "content": train_problem}]
)

print(response.choices[0].message.content)
  • V4-Pro डिफ़ॉल्ट रूप से तर्क करता है → अतिरिक्त पैरामीटर की ज़रूरत नहीं
Python में DeepSeek के साथ काम करना
print(response.choices[0].message.content)
**चरण 1 - ट्रेन की गति निकालें**
Speed = 60 / 1.5 = **40 mph**

**चरण 2 - 4 hours में दूरी**
Distance = 40 × 4 = **160 miles**

**चरण 3 - आगमन समय**
2:15 PM + 4 hours = **6:15 PM**

**अंतिम उत्तर:** 160 miles, 6:15 PM पर पहुँचना
Python में DeepSeek के साथ काम करना

Reasoning बंद करना

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4.1-Flash",
    extra_body={"thinking": {"type": "disabled"}},
    messages=[{"role": "user", "content": prompt}]
)
  • Thinking डिफ़ॉल्ट रूप से "enabled" है; बाहर निकलने के लिए "disabled" पास करें
  • बिना reasoning के, मॉडल एक मानक chat मॉडल जैसा व्यवहार करता है
Python में DeepSeek के साथ काम करना

Effort बढ़ाना

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4.1-Flash",
    reasoning_effort="max",
    messages=[{"role": "user", "content": train_problem}]
)

print(response.choices[0].message.content)
  • डिफ़ॉल्ट effort "high" है → कठिन समस्याओं के लिए "max" रखें
  • reasoning effort बढ़ाने से लागत बढ़ती है
  • हमेशा पहले _कम_ reasoning effort पर टेस्ट करें
Python में DeepSeek के साथ काम करना

अभ्यास करते हैं!

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

Preparing Video For Download...