fix: trigger gemini retry with ValueError (#1918)

This commit is contained in:
Sarah Wooders
2025-04-28 18:47:29 -07:00
committed by GitHub
parent a9cd78cc3b
commit b6095d76e4

View File

@@ -122,6 +122,10 @@ class GoogleAIClient(LLMClientBase):
for candidate in response_data["candidates"]:
content = candidate["content"]
if "role" not in content:
# This means the response is malformed
# NOTE: must be a ValueError to trigger a retry
raise ValueError(f"Error in response data from LLM: {response_data}")
role = content["role"]
assert role == "model", f"Unknown role in response: {role}"