Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: Fix error messages with malformed gemini call (#3865)
Matthew Zhou5772365285ee
diff --git a/letta/llm_api/google_vertex_client.py b/letta/llm_api/google_vertex_client.pyindex fa6cf17df..028871dbe 100644--- a/letta/llm_api/google_vertex_client.py+++ b/letta/llm_api/google_vertex_client.py@@ -303,11 +303,11 @@ class GoogleVertexClient(LLMClientBase):for candidate in response.candidates:content = candidate.content- if content.role is None or content.parts is None:+ if content is None or content.role is None or content.parts is None:# This means the response is malformed like MALFORMED_FUNCTION_CALL# NOTE: must be a ValueError to trigger a retryif candidate.finish_reason == "MALFORMED_FUNCTION_CALL":- raise ValueError(f"Error in response data from LLM: {candidate.finish_message[:350]}...")+ raise ValueError(f"Error in response data from LLM: {candidate.finish_reason}...")else:raise ValueError(f"Error in response data from LLM: {response_data}")