From c0a395409885730bfb8691a46cadc4c07267cb0d Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 18 May 2026 01:36:20 -0500 Subject: [PATCH] fix: guard against empty choices in LLM completion response --- examples/demo/agents/openai_completion_agent.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/demo/agents/openai_completion_agent.py b/examples/demo/agents/openai_completion_agent.py index c3f06b00..a0f5bf57 100644 --- a/examples/demo/agents/openai_completion_agent.py +++ b/examples/demo/agents/openai_completion_agent.py @@ -73,5 +73,7 @@ def say(self, content: str) -> bool: max_tokens=500, ) # parse the output + if not completion.choices: + raise ValueError("LLM returned empty choices list") action = util.extract_json(completion.choices[0].text, ["/END"]) self.send(action)