diff --git a/libs/genai/langchain_google_genai/chat_models.py b/libs/genai/langchain_google_genai/chat_models.py index 086fa23e..7ae17fa8 100644 --- a/libs/genai/langchain_google_genai/chat_models.py +++ b/libs/genai/langchain_google_genai/chat_models.py @@ -419,6 +419,9 @@ def _parse_response_candidate( for part in response_candidate.content.parts: try: text: Optional[str] = part.text + # Remove erroneous newline character if present + if text is not None: + text = text.rstrip("\n") except AttributeError: text = None