diff --git a/letta/llm_api/google_vertex_client.py b/letta/llm_api/google_vertex_client.py index fa6cf17d..028871db 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 retry if 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}")