Skip to content

Commit

Permalink
Fix null handling case for functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Oct 3, 2023
1 parent be92333 commit 8a31a83
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions easycompletion/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,17 @@ def do_chat_completion(
response = None
for i in range(model_failure_retries):
try:
response = openai.ChatCompletion.create(
model=model, messages=messages, temperature=temperature,
functions=functions, function_call=function_call,
)
if functions is not None:
response = openai.ChatCompletion.create(
model=model, messages=messages, temperature=temperature,
functions=functions, function_call=function_call,
)
else:
response = openai.ChatCompletion.create(
model=model, messages=messages, temperature=temperature
)
print('response')
print(response)
break
except Exception as e:
log(f"OpenAI Error: {e}", type="error", log=debug)
Expand Down

0 comments on commit 8a31a83

Please sign in to comment.