hertogateis commited on
Commit
7c62114
·
verified ·
1 Parent(s): 96d870c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -0
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
+
4
+ url = "https://api.deepseek.com/chat/completions"
5
+
6
+ payload = json.dumps({
7
+ "messages": [
8
+ {
9
+ "content": "You are a helpful assistant",
10
+ "role": "system"
11
+ },
12
+ {
13
+ "content": "Hi",
14
+ "role": "user"
15
+ }
16
+ ],
17
+ "model": "deepseek-chat",
18
+ "frequency_penalty": 0,
19
+ "max_tokens": 2048,
20
+ "presence_penalty": 0,
21
+ "response_format": {
22
+ "type": "text"
23
+ },
24
+ "stop": None,
25
+ "stream": False,
26
+ "stream_options": None,
27
+ "temperature": 1,
28
+ "top_p": 1,
29
+ "tools": None,
30
+ "tool_choice": "none",
31
+ "logprobs": False,
32
+ "top_logprobs": None
33
+ })
34
+ headers = {
35
+ 'Content-Type': 'application/json',
36
+ 'Accept': 'application/json',
37
+ 'Authorization': 'Bearer <TOKEN>'
38
+ }
39
+
40
+ response = requests.request("POST", url, headers=headers, data=payload)
41
+
42
+ print(response.text)