Asistan rolünü kullanma

Python ile DeepSeek Kullanımı

James Chapman

AI Curriculum Lead, DataCamp

Tek turluk görevler

response = client.chat.completions.create(
  model="deepseek-ai/DeepSeek-V4-Pro",
  messages=[{"role": "system",
             "content": "You are a Python programming tutor who responds using concise,
                         one-sentence explanations."},
            {"role": "user",
             "content": "What is the difference between mutable and immutable objects?"}]
)
  • System: asistanın davranışını kontrol eder
  • User: asistanı yönlendirir
  • Assistant: kullanıcı talimatına yanıt verir
Python ile DeepSeek Kullanımı

Örnekler sağlama

 

  • Modeli doğru yöne yönlendir
  • Asistan mesajları, shot-prompting için daha yapılı bir yoldur
  • Örnek: Python Programlama Eğitmeni
    • Örnek kullanıcı soruları ve yanıtları

Bir veri bilimi baykuşu.

Python ile DeepSeek Kullanımı

Örnekler sağlama

response = client.chat.completions.create(
  model="deepseek-ai/DeepSeek-V4-Pro",
  messages=[{"role": "system",
             "content": "You are a Python programming tutor who responds using concise,
                         one-sentence explanations."},

{"role": "user", "content": "How do you define a Python list?"},
{"role": "assistant", "content": "Lists are defined by enclosing a comma-separated sequence of objects inside square brackets [ ]."},
{"role": "user", "content": "What is the difference between mutable and immutable objects?"}] )
Python ile DeepSeek Kullanımı

Yanıt

print(response.choices[0].message.content)
Mutable objects can be changed after creation (like lists), while immutable objects cannot
(like tuples or strings).
  • Deneme yap: örnek sayısını değiştir
Python ile DeepSeek Kullanımı

System vs. assistant vs. user

System → önemli şablon biçimlendirmesi

Output the information in this format:
name | age | occupation

Assistant → örnek konuşmalar

User → yeni girdi için gereken bağlam (genelde tek turluk)

Create a job advert for an AI Engineer. Use this job advert as a template:

Job Title: Data Engineer
...
Python ile DeepSeek Kullanımı

Hadi pratik yapalım!

Python ile DeepSeek Kullanımı

Preparing Video For Download...