fix: adds checks for empty openai choices
This commit is contained in:
parent
b146596ee6
commit
aa610d5c86
1 changed files with 7 additions and 0 deletions
|
|
@ -204,6 +204,10 @@ class LLMClient:
|
|||
tools=tools,
|
||||
extra_body=extra_body,
|
||||
)
|
||||
|
||||
if len(response.choices) == 0:
|
||||
return None
|
||||
|
||||
tool_calls = response.choices[0].message.tool_calls
|
||||
if tool_calls:
|
||||
parsed_tool_calls = [
|
||||
|
|
@ -506,6 +510,9 @@ class LLMClient:
|
|||
extra_body=extra_body,
|
||||
)
|
||||
|
||||
if len(response.choices) == 0:
|
||||
return None
|
||||
|
||||
content = response.choices[0].message.content
|
||||
|
||||
tool_calls = response.choices[0].message.tool_calls
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue