Text generation

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

James Chapman

AI Curriculum Lead, DataCamp

आउटपुट कैसे बनता है?

  • बातचीत को पूरा करने वाला सबसे संभावित टेक्स्ट
response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",

messages=[{"role": "user", "content": "Hi! I'm James and I'm a Curriculum Manager at DataCamp."}]
) print(response.choices[0].message.content)
Hi James! It's great to meet you. As a **Curriculum Manager at DataCamp**, you must
play a key role in shaping the learning experience for data science and analytics
students. How can I assist you today?
  • प्रतिक्रिया non-deterministic है (स्वभावतः यादृच्छिक)
Python में DeepSeek के साथ काम करना

दो अर्थ-समान अनुरोध लेते हुए कस्टमर सपोर्ट चैटबोट।

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

रिस्पॉन्स की यादृच्छिकता नियंत्रित करें

  • temperature: determinism पर नियंत्रण 0 (बहुत निर्धारक) से 2 (बहुत यादृच्छिक) तक
  • रीजनिंग सक्षम होने पर चुपचाप नज़रअंदाज़ होता है → इसे उपयोग करने के लिए disable करें
response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",
    extra_body={"thinking": {"type": "disabled"}},
    messages=[{"role": "user",
             "content": "Hi! I'm James and I'm a Curriculum Manager at DataCamp."}],

temperature=2
) print(response.choices[0].message.content)
Hi James! Welcome to DataCamp - it's great to connect with someone who works on
shaping learning experiences for data skills. What does your role typically involve
as a Curriculum Manager at **DataCamp?** Perhaps one-on95 kWielpulses.Z.blog.from...
Python में DeepSeek के साथ काम करना

Text generation: मार्केटिंग

prompt = "Generate a powerful tagline for a new electric vehicle 
that highlights innovation and sustainability."
response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",
    messages=[{"role": "user", "content": prompt}]
)

print(response.choices[0].message.content)
**"Drive the Future - Zero Emissions, Infinite Innovation."**  
This tagline captures the essence of cutting-edge technology and eco-conscious...
Python में DeepSeek के साथ काम करना

रिस्पॉन्स को साफ़ करना

prompt = "Generate a powerful tagline for a new electric vehicle 
that highlights innovation and sustainability. Return only the tagline
without formatting."

# Create a request to the chat model
# ...
"Drive the Future - Clean, Smart, Electric."
Python में DeepSeek के साथ काम करना

Text generation: उत्पाद विवरण

prompt = """Write a compelling e-commmerce product description for the UltraFit
Smartwatch in paragraph form. Highlight its key features:

10-day battery life, 24/7 heart rate and sleep tracking, built-in GPS, water
resistance up to 50 meters, and lightweight design.

Use a persuasive and engaging tone to appeal to fitness enthusiasts and busy
professionals.
"""

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

Text generation: उत्पाद विवरण

print(response.choices[0].message.content)
"The UltraFit Smartwatch is your all-in-one health and fitness companion. 
Stay on top of your wellness with 24/7 heart rate and sleep tracking, 
while the built-in GPS keeps you on course during runs. 
With a 10-day battery life, you can track your progress without constant recharging. 
Designed for both workouts and daily wear, its  lightweight build and 50-meter
water resistance make it the perfect smartwatch for an active lifestyle."
  • Iterate! प्रॉम्प्ट में और विवरण जोड़ें और रिक्वेस्ट फिर चलाएँ
  • अगला वीडियो → मॉडल को उदाहरण देना
Python में DeepSeek के साथ काम करना

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

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

Preparing Video For Download...