Derin analiz ve kod üretimi

Python ile DeepSeek Kullanımı

James Chapman

AI Curriculum Lead, DataCamp

Özet...

print(response.choices[0].message.content)
Adım 1 - ...
Adım 2 - ...
Nihai Yanıt: ...
  • Muhakeme varsayılan olarak açık → reasoning_effort="high" veya "max" ile ayarla
  • Muhakeme açıkken temperatureın etkisi yoktur
Python ile DeepSeek Kullanımı

1. Basit tut

  • Kısa ve net istemler

✅ What are the differences between lists and tuples in Python?

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

  • Örnek vermek (ör. few-shot) performansı azaltabilir

✅ Who developed the Python programming language?

❌

Example 1:
Q: Who developed the R programming language?
A: Ross Ihaka and Robert Gentleman
Python ile DeepSeek Kullanımı

2. Akıl yürütmeyi teşvik et

 

"... Acele etme, her adımı düşün."

 

❌ Daha fazla token kullanımı

❌ Daha uzun yanıt süresi

Python ile DeepSeek Kullanımı

3. Basit işlerden uzak dur!

 

Sohbet modu

Basit bir görevi kolayca tamamlayan bir sohbet modeli.

 

Muhakeme modu

Basit sorunlarda zorlanan bir muhakeme modeli.

Python ile DeepSeek Kullanımı

3. Basit işlerden uzak dur!

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4.1-Flash",
    messages=[{"role": "user", "content": "Return the result of 1+1."}]
)
print(response.choices[0].message.content)
Hadi adım adım sayalım.
- 1 ile başla.
- Bir 1 daha ekle.
- 1 + 1 = 2.

**Nihai Yanıt: 2**
  • Önemsiz sorgular için yapısal muhakeme gereksizdir
  • Sohbet tarzı yanıta göre daha fazla token ve daha fazla gecikme maliyeti vardır
Python ile DeepSeek Kullanımı

Örnek: Kod hata ayıklama

Kod ayıklayan bir insan.

Muhakeme modelinin iş akışı.

Python ile DeepSeek Kullanımı

Örnek: Kod hata ayıklama

Hata mesajına göre kodu düzelten bir muhakeme modeli.

Python ile DeepSeek Kullanımı

Örnek: Kod hata ayıklama

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

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

count_to_ten(1)
"""
Python ile DeepSeek Kullanımı
print(response.choices[0].message.content)
Fonksiyonu adım adım inceleyeyim.

Fonksiyon bir while döngüsü kullanıyor: while start < 10. Sonra start'ı yazdırıyor. Ama dur, döngünün içinde
start değişkeni artırılmıyor — sorun bu.

Çözüm: döngü içinde start'ı artırmak, örneğin start += 1.

Düzeltilmiş kod şöyle:

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

count_to_ten(1)
Python ile DeepSeek Kullanımı

Hadi pratik yapalım!

Python ile DeepSeek Kullanımı

Preparing Video For Download...