diff --git a/libs/partners/google-genai/langchain_google_genai/chat_models.py b/libs/partners/google-genai/langchain_google_genai/chat_models.py index 420dbcfd135958..496f54add55131 100644 --- a/libs/partners/google-genai/langchain_google_genai/chat_models.py +++ b/libs/partners/google-genai/langchain_google_genai/chat_models.py @@ -598,6 +598,7 @@ def _stream( for chunk in response: _chat_result = _response_to_result(chunk, stream=True) gen = cast(ChatGenerationChunk, _chat_result.generations[0]) + if run_manager: run_manager.on_llm_new_token(gen.text) yield gen @@ -622,6 +623,7 @@ async def _astream( ): _chat_result = _response_to_result(chunk, stream=True) gen = cast(ChatGenerationChunk, _chat_result.generations[0]) + if run_manager: await run_manager.on_llm_new_token(gen.text) yield gen