गहराई से विश्लेषण और कोड जनरेशन

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

James Chapman

AI Curriculum Lead, DataCamp

पुनरावलोकन...

print(response.choices[0].message.content)
Step 1 - ...
Step 2 - ...
Final Answer: ...
  • Reasoning डिफ़ॉल्ट रूप से ऑन हैreasoning_effort="high" या "max" से ट्यून करें
  • temperature का reasoning के दौरान कोई प्रभाव नहीं
Python में DeepSeek के साथ काम करना

1. इसे सरल रखें

  • संक्षिप्त प्रॉम्प्ट्स

What are the differences between lists and tuples in Python?

In Python, there are different data structures. Lists are...

  • उदाहरण देना (जैसे, few-shot) प्रदर्शन घटा सकता है

Who developed the Python programming language?

Example 1:
Q: Who developed the R programming language?
A: Ross Ihaka and Robert Gentleman
Python में DeepSeek के साथ काम करना

2. तर्क-वितर्क को प्रोत्साहित करें

 

"... Take your time and think through each step."

 

टोकन उपयोग बढ़ता है

रिस्पॉन्स समय बढ़ता है

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

3. सरल टास्क से दूर रहें!

 

चैट मोड

एक चैट मॉडल सरल टास्क आसानी से पूरा कर रहा है.

 

Reasoning मोड

एक reasoning मॉडल सरल समस्याओं से जूझ रहा है.

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

3. सरल टास्क से दूर रहें!

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",
    messages=[{"role": "user", "content": "Return the result of 1+1."}]
)
print(response.choices[0].message.content)
Let's count step by step.
- Start with 1.
- Add another 1.
- 1 + 1 = 2.

**Final Answer: 2**
  • तुच्छ लुकअप के लिए, structured reasoning ओवरकिल है
  • चैट-स्टाइल उत्तर की तुलना में अधिक टोकन और अधिक लेटेंसी लगती है
Python में DeepSeek के साथ काम करना

उदाहरण: कोड डिबगिंग

कोड डिबग करता हुआ इंसान.

reasoning मॉडल का वर्कफ़्लो.

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

उदाहरण: कोड डिबगिंग

त्रुटि के आधार पर कोड ठीक करता reasoning मॉडल.

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

उदाहरण: कोड डिबगिंग

prompt = """
[Task: Fix the following code.]

Code:
def count_to_ten(start):
    while start < 10:
        print(start)
    return "Done"

count_to_ten(1)
"""
Python में DeepSeek के साथ काम करना
print(response.choices[0].message.content)
मैं फ़ंक्शन को चरण-दर-चरण देखता हूँ.

फ़ंक्शन में while लूप है: while start < 10. फिर यह start प्रिंट करता है. लेकिन रुकिए, लूप के अंदर
start वैरिएबल का increment नहीं है — यही समस्या है.

समाधान: लूप के अंदर start को increment करें, जैसे start += 1.

सुधारा हुआ कोड:

def count_to_ten(start):
    while start < 10:
        print(start)
        start += 1
    return "Done"

count_to_ten(1)
Python में DeepSeek के साथ काम करना

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

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

Preparing Video For Download...