Asistan mesajları ekleme
Sohbet modu, konuşmaya dayalı uygulamalar oluşturmak için harikadır ve modelin üzerine inşa edebileceği bir konuşma bölümünü sağlayarak daha da geliştirilebilir.
Bu coğrafya eğitmeni uygulamasını, mesajlara aşağıdaki örnek öğrenci istemini ve ideal model yanıtını ekleyerek geliştir:
- Örnek Soru:
Give me a quick summary of Portugal. - Örnek Yanıt:
Portugal is a country in Europe that borders Spain. The capital city is Lisboa.
Bu egzersiz, kursun bir parçasıdır
Python ile DeepSeek Kullanımı
Egzersiz talimatları
- Modele gönderilen mesajlarda verilen örnek soru ve yanıtı bir kullanıcı-asistan çifti olarak ekle.
- Örnek Soru:
Give me a quick summary of Portugal. - Örnek Yanıt:
Portugal is a country in Europe that borders Spain. The capital city is Lisboa.
- Örnek Soru:
Uygulamalı etkileşimli egzersiz
Bu egzersizi bu örnek kodu tamamlayarak deneyin.
client = OpenAI(api_key="", base_url="https://api.together.xyz/v1")
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4-Pro",
# Add a user and assistant message for in-context learning
messages=[
{"role": "system", "content": "You are a helpful Geography tutor that generates concise, one-sentence summaries for different countries."},
____,
____,
{"role": "user", "content": "Give me a quick summary of Greece."}
]
)
print(response.choices[0].message.content)