mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
o
This commit is contained in:
parent
f350a105f2
commit
7a0238666f
3 changed files with 26 additions and 2 deletions
24
searx/testcpt3.py
Normal file
24
searx/testcpt3.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
import requests, os, json
|
||||
gpt = ""
|
||||
prompt = "你好"
|
||||
gpt_url = "https://api.openai.com/v1/chat/completions"
|
||||
gpt_headers = {
|
||||
"Authorization": "Bearer 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",
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
gpt_data = {
|
||||
"model": "gpt-3.5-turbo",
|
||||
"messages": [{"user":prompt}],
|
||||
"max_tokens": 256,
|
||||
"temperature": 0.9,
|
||||
"top_p": 1,
|
||||
"frequency_penalty": 0,
|
||||
"presence_penalty": 0,
|
||||
"stream": False
|
||||
|
||||
}
|
||||
gpt_response = requests.post(gpt_url, headers=gpt_headers, data=json.dumps(gpt_data))
|
||||
if prompt and prompt !='' :
|
||||
gpt_response = requests.post(gpt_url, headers=gpt_headers, data=json.dumps(gpt_data))
|
||||
gpt_json = gpt_response.json()
|
||||
print(gpt_json)
|
|
@ -733,7 +733,7 @@ def search():
|
|||
}
|
||||
gpt_data = {
|
||||
"model": "gpt-3.5-turbo",
|
||||
"messages": [{"user":prompt}],
|
||||
"messages": [{"role":"user","content":prompt}],
|
||||
"max_tokens": 256,
|
||||
"temperature": 0.9,
|
||||
"top_p": 1,
|
||||
|
|
|
@ -733,7 +733,7 @@ def search():
|
|||
}
|
||||
gpt_data = {
|
||||
"model": "gpt-3.5-turbo",
|
||||
"messages": [{"user":prompt}],
|
||||
"messages": [{"role":"user","content":prompt}],
|
||||
"max_tokens": 256,
|
||||
"temperature": 0.9,
|
||||
"top_p": 1,
|
||||
|
|
Loading…
Add table
Reference in a new issue