diff --git a/servers/fastapi/services/llm_client.py b/servers/fastapi/services/llm_client.py index 0ecde95e..9662122d 100644 --- a/servers/fastapi/services/llm_client.py +++ b/servers/fastapi/services/llm_client.py @@ -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