Bul ve değiştir
Bul-ve-değiştir araçları onlarca yıldır var, ancak genellikle yalnızca tam kelime veya ifadeleri bulup değiştirmekle sınırlıdır. Sana arabaları anlatan bir metin bloğu verildi ve bu metni uygun biçimde güncelleyerek uçaklardan bahsedecek hale getirmek için bir sohbet tamamlama modelini kullanacaksın.
Bu egzersiz, kursun bir parçasıdır
Python ile DeepSeek Kullanımı
Egzersiz talimatları
- Arabalarla ilgili bir metin parçasını uçaklara dönüştürmek için
prompt'udeepseek-ai/DeepSeek-V4.1-Flashmodeline gönderen bir istek oluştur; en fazla100token kullan. - API'den gelen yanıt metnini çıkar ve yazdır.
Uygulamalı etkileşimli egzersiz
Bu egzersizi bu örnek kodu tamamlayarak deneyin.
client = OpenAI(api_key="", base_url="https://api.together.xyz/v1")
prompt="""Replace car with plane and adjust phrase:
A car is a vehicle that is typically powered by an internal combustion engine or an electric motor. It has four wheels, and is designed to carry passengers and/or cargo on roads or highways. Cars have become a ubiquitous part of modern society, and are used for a wide variety of purposes, such as commuting, travel, and transportation of goods. Cars are often associated with freedom, independence, and mobility."""
# Create a request to the chat model
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4.1-Flash",
messages=[{"role": "user", "____": ____}],
____
)
# Extract and print the response text
print(response.choices[0].____.____)