Skip to content

Commit

Permalink
Merge pull request #413 from EvgSkv/ti2023
Browse files Browse the repository at this point in the history
Update AI api call.
  • Loading branch information
EvgSkv authored Jan 9, 2025
2 parents cfd03cd + b549990 commit a314a15
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions common/intelligence.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,20 @@ def Intelligence(command):
InitializeOpenAI()
intelligence_executed = True

args = INTELLIGENCE_PARAMS.copy()
args['prompt'] = command
response = openai.Completion.create(**args)
client = openai.OpenAI(api_key=openai.api_key)
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{
"role": "user",
"content": command
}
],
temperature=1,
max_tokens=512,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)

response_text = response.choices[0].text.strip()

return response_text
return response.choices[0].message.content

0 comments on commit a314a15

Please sign in to comment.