Spaces:
Sleeping
Sleeping
File size: 1,065 Bytes
b0d08f5 cc86e76 b0d08f5 6cc8274 b0d08f5 5957ac9 b0d08f5 348a356 b0d08f5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import requests
import json
# Replace with your actual API key
API_KEY = "sk-3df8d86d5a4b49cb9240077792c55d0a"
API_URL = "https://api.deepseek.com/v1/chat/completions" # Example endpoint, check documentation
# Define the prompt in Bahasa Indonesia
prompt = "Halo, bisakah kamu membantu saya membuat rencana perjalanan ke Bali?"
# Prepare the payload
payload = {
"model": "deepseek-v3", # Replace with the model you want to use
"messages": [
{"role": "user", "content": prompt}
],
"max_tokens": 150, # Adjust as needed
"temperature": 0.7, # Adjust for creativity
}
# Set headers
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
# Make the API request
response = requests.post(API_URL, headers=headers, data=json.dumps(payload))
# Check the response
if response.status_code == 200:
result = response.json()
generated_text = result['choices'][0]['message']['content']
print("Generated Text:", generated_text)
else:
print("Error:", response.status_code, response.text) |