feat: add informative error for max tokens exceeded (#2223)

This commit is contained in:
cthomas
2025-05-16 14:02:11 -07:00
committed by GitHub
parent 3644a17426
commit 067facbfc7

View File

@@ -235,6 +235,8 @@ class GoogleVertexClient(GoogleAIClient):
)
except json.decoder.JSONDecodeError:
if candidate.finish_reason == "MAX_TOKENS":
raise ValueError(f"Could not parse response data from LLM: exceeded max token limit")
# Inner thoughts are the content by default
inner_thoughts = response_message.text