From e9a6a048381fc6435d015b970c42cb7e486208a5 Mon Sep 17 00:00:00 2001 From: Jonathan Hill Date: Mon, 18 May 2026 04:20:34 -0500 Subject: [PATCH] fix: guard against empty/filtered LLM responses in make_me_say utils An empty choices list raises IndexError; a None message raises AttributeError. Add a null check before accessing choices[0].message. --- evals/elsuite/make_me_say/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/evals/elsuite/make_me_say/utils.py b/evals/elsuite/make_me_say/utils.py index ba44b2950e..d37cc0e449 100644 --- a/evals/elsuite/make_me_say/utils.py +++ b/evals/elsuite/make_me_say/utils.py @@ -43,4 +43,6 @@ def get_content(response: Union[dict, CompletionResult]) -> str: assert len(completions) == 1, f"Got {len(completions)} but expected exactly one" return completions[0] + if not response.choices or response.choices[0].message is None: + raise ValueError("LLM returned empty or filtered response") return response.choices[0].message.content