पाठ का संक्षेपण और संपादन

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

James Chapman

AI Curriculum Lead, DataCamp

दोहरेखापन...

  • प्रश्नोत्तर (Q&A)
response = client.chat.completions.create(
  model="deepseek-ai/DeepSeek-V4-Pro",
  messages=[{"role": "user", "content": "How many days are in October?"}]
)

print(response.choices[0].message.content)
October में **31 days** होते हैं.  

यह Gregorian कैलेंडर के सात महीनों में से एक है जिनमें 31 days होते हैं...
Python में DeepSeek के साथ काम करना

टेक्स्ट एडिटिंग

  • उदाहरण: name, pronouns, और job title अपडेट करना

$$

prompt = """
Update name to Maarten, pronouns to he/him, and job title to Senior Content Developer
in the following text:

Joanne is a Content Developer at DataCamp. Her favorite programming language is R,
which she uses for her statistical analyses.
"""
Python में DeepSeek के साथ काम करना

टेक्स्ट एडिटिंग

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",

messages=[{"role": "user", "content": prompt}]
) print(response.choices[0].message.content)
यहाँ आपके अनुरोधित बदलावों के साथ अपडेट किया गया टेक्स्ट है:

Maarten is a Senior Content Developer at DataCamp. His favorite programming language
is R, which he uses for his statistical analyses.

अगर आप और कोई समायोजन चाहते हैं तो बताइए!
Python में DeepSeek के साथ काम करना

टेक्स्ट समरीकरण

  • उदाहरण: customer chat transcripts का सारांश

कस्टमर सपोर्ट टीम

text = """
Customer: Hi, I'm trying to log into 
my account, but it keeps saying 
my password is incorrect. I'm sure 
I'm entering the right one.  

Support: I'm sorry to hear that! 
Have you tried resetting your password?  
...
"""
Python में DeepSeek के साथ काम करना

टेक्स्ट समरीकरण

prompt = f"""Summarize the customer support chat 
             in three concise key points: {text}"""


response = client.chat.completions.create( model="deepseek-ai/DeepSeek-V4-Pro", messages=[{"role": "user", "content": prompt}] ) print(response.choices[0].message.content)
1. **लॉगिन समस्या**: पासवर्ड इश्यू और reset लिंक न मिलने से ग्राहक लॉगिन नहीं कर सका.  
2. **पासवर्ड रीसेट सुझाव**: पुष्टि के बाद सपोर्ट ने रीसेट ईमेल फिर से भेजा.  
3. **त्वरित सहायता**: ग्राहक ने Google sign-in से समस्या हल की.
Python में DeepSeek के साथ काम करना

रिस्पॉन्स की लंबाई नियंत्रित करना

  • max_tokens = 5
response = client.chat.completions.create(
  model="deepseek-ai/DeepSeek-V4-Pro",
  messages=[{"role":"user",
      "content":"Write a haiku about AI."}],
  max_tokens=5
)

**मौन सर्किट्स गुनगुन
  • max_tokens = 30
response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",
    messages=[{"role":"user",
      "content":"Write a haiku about AI."}],
    max_tokens=30
)

**मौन सर्किट्स गुनगुनाएँ,**  
**रोशनी-तर्क के फूल खिलें—**  
**हमसे परे मन.**
Python में DeepSeek के साथ काम करना

टोकन समझना

$$

  • Tokens: टेक्स्ट की इकाइयाँ जिनसे AI टेक्स्ट समझता और इंटरप्रेट करता है

$$

वाक्य, "How can the OpenAI API deliver business value?" जिसमें हर टोकन अलग रंग में हाइलाइट है.

1 https://lunary.ai/deepseek-tokenizer
Python में DeepSeek के साथ काम करना

लागत की गणना

 

  • API उपयोग लागत platform, model, और tokens की संख्या पर निर्भर करती है 💰

    • Models का मूल्य cost/tokens से होता है
    • Input और output tokens की लागत अलग हो सकती है
  • max_tokens बढ़ाने से लागत बढ़ती है 📈

Screenshot 2025-03-05 at 11.46.54.png

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

लागत की गणना

prompt = f"""Summarize the customer support chat 
             in three concise key points: {text}"""

max_tokens = 500

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",
    messages=[{"role": "user", "content": prompt}], 
    max_tokens=max_tokens
)
Python में DeepSeek के साथ काम करना

लागत की गणना

# Define price per token
input_token_price = 2.1 / 1_000_000
output_token_price = 4.4 / 1_000_000

# Extract token usage input_tokens = response.usage.prompt_tokens
output_tokens = max_tokens
# Calculate cost cost = (input_tokens * input_token_price + output_tokens * output_token_price) print(f"Estimated cost: ${cost}")
Estimated cost: $0.0153964
Python में DeepSeek के साथ काम करना

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

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

Preparing Video For Download...