Skip to content

Commit 01f18c6

Browse files
committed
fix(llm): guard against empty/None choices
1 parent a245a0c commit 01f18c6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/balatrollm/llm.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ async def call(
8888
try:
8989
response = await self._client.chat.completions.create(**request_data)
9090
self._consecutive_timeouts = 0
91+
92+
# Guard against API returning empty/None choices
93+
if not response.choices:
94+
raise LLMClientError("API returned empty response (no choices)")
95+
9196
return response
9297

9398
except openai.APITimeoutError as e:

0 commit comments

Comments
 (0)