Update src/aidgaf/aidgaf_server/idgaf.py
This commit is contained in:
parent
a649fa87a4
commit
1a91cbc8cc
@ -12,7 +12,7 @@ URL = "https://api.openai.com/v1/completions"
|
|||||||
""" The URL for the OpenAI API. """
|
""" The URL for the OpenAI API. """
|
||||||
|
|
||||||
DATA = {"model": settings.OPEN_AI_COMPLETION_MODEL,
|
DATA = {"model": settings.OPEN_AI_COMPLETION_MODEL,
|
||||||
"prompt": settings.PROMPTS[0],
|
"messages": [{"role":"user", "content": settings.PROMPTS[0] }],
|
||||||
"temperature": settings.TEMPERATURE,
|
"temperature": settings.TEMPERATURE,
|
||||||
"max_tokens": settings.OPEN_AI_MAX_TOKENS
|
"max_tokens": settings.OPEN_AI_MAX_TOKENS
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ def parse_idgaf_request(idgaf_command) -> [int, dict]:
|
|||||||
the_data = get_prompt(idgaf_command)
|
the_data = get_prompt(idgaf_command)
|
||||||
response = get_gpt_response(the_data)
|
response = get_gpt_response(the_data)
|
||||||
try:
|
try:
|
||||||
response_text = response.json()['choices'][0]['text'].strip()
|
response_text = response.json()['choices'][0]['message']["content"].strip()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
response_text = response.text
|
response_text = response.text
|
||||||
obj = get_response_base_object(response_text)
|
obj = get_response_base_object(response_text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user