File size: 1,071 Bytes
b0d08f5
 
cc86e76
b0d08f5
38d93ed
e5673a8
6cc8274
b0d08f5
 
5957ac9
b0d08f5
 
7eb16ff
b0d08f5
7eb16ff
b0d08f5
7eb16ff
 
b0d08f5
348a356
b0d08f5
 
 
 
 
6fae206
 
afc42e6
b0d08f5
 
afc42e6
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
37
38
39
import requests
import json

# Replace with your actual API key
API_KEY = "DEEPSEEK_API_KEY"
#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",
    "messages": [
        {"role": "user", "content": "Halo, apa kabar?"}
    ],
    "max_tokens": 150,
    "temperature": 0.7,
}

# Set headers
headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json",
}
#response = requests.get(API_URL, headers=headers)
#print(response.status_code, response.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)