[GH-ISSUE #4019] [langchain]: Need more clarity on ChatGoogleGenerativeAI streaming in reference docs. #2773

Open
opened 2026-06-05 17:26:43 -04:00 by yindo · 1 comment
Owner

Originally created by @Wonder-donbury on GitHub (May 15, 2026).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/4019

Type of issue

request for content

Language

Python

Description

Hi, I have spent hours on utilizing ChatGoogleGenerativeAI with gemini-3 series models to be running correctly in the agent I have in my project. Along with content addition on docs, I have some genuine questions as well.

--

the current documentation is missing 2 important parts with streaming with the ChatGoogleGenerativeAI.

  • 1. Best practice on separating thought signatures contained in AIMessageChunk.content

I have both read the documentations for ChatGoogleGenerativeAI and it tells to refer to Google Developers page for details, and when I come back to ChatGoogleGenerativeAI docs, there seems to be a gap on how it handles the streaming blocks. Currently AiMessageChunk.content contains a list, which I haven't quite expected, and inside each list there is a dictionary with the real text chunk and thought signatures as follows:

[{"type":"text","text":"<real_text_chunk>","extra":{"thought_signature":"<encrypted_text>"}}]

and the thought signature seems to be arriving at the last message chunk - the docs is missing this information.

is there a best practice on turning the series of chunks into a AIMessage? I wanted to use the __add__ but I'm not sure if it's a good idea

  • 2. Best practice on keeping the gemini's thought signatures after streamining to ensure long-running agent states.

I think the docs also have to explicitly include the fact that the reduced AIMessage from AIMessageChunk should persist the thought_signature inside AIMessage.additional_kwargs. - the docs is missing this information on how to get the AIMessage from the end of .astream without reconstructing AIMessage from the chunks (as the docs tell us not to do so)

Originally created by @Wonder-donbury on GitHub (May 15, 2026). Original GitHub issue: https://github.com/langchain-ai/docs/issues/4019 ### Type of issue request for content ### Language Python ### Description Hi, I have spent hours on utilizing `ChatGoogleGenerativeAI` with gemini-3 series models to be running correctly in the agent I have in my project. Along with content addition on docs, I have some genuine questions as well. -- the current documentation is missing 2 important parts with streaming with the `ChatGoogleGenerativeAI`. - ## 1. Best practice on separating thought signatures contained in `AIMessageChunk.content` I have both read the documentations for `ChatGoogleGenerativeAI` and it tells to refer to **Google Developers page** for details, and when I come back to `ChatGoogleGenerativeAI` docs, there seems to be a gap on how it handles the streaming blocks. Currently `AiMessageChunk.content` contains a list, which I haven't quite expected, and inside each list there is a dictionary with the real text chunk and thought signatures as follows: `[{"type":"text","text":"<real_text_chunk>","extra":{"thought_signature":"<encrypted_text>"}}]` and the thought signature seems to be arriving at the last message chunk - the docs is missing this information. is there a best practice on turning the series of chunks into a AIMessage? I wanted to use the `__add__` but I'm not sure if it's a good idea - ## 2. Best practice on keeping the gemini's thought signatures after streamining to ensure long-running agent states. I think the docs also have to explicitly include the fact that the reduced `AIMessage` from `AIMessageChunk` should persist the thought_signature inside `AIMessage.additional_kwargs`. - the docs is missing this information on how to get the `AIMessage` from the end of `.astream` without reconstructing `AIMessage` from the chunks (as the docs tell us not to do so)
yindo added the langchainexternal labels 2026-06-05 17:26:43 -04:00
Author
Owner

@Wonder-donbury commented on GitHub (May 15, 2026):

After spending an hour figuring out why tool call didn't worked with gemini-3 streaming, I found the followings. Can you please have a look and decide whether to add the following points in the relevant docs? Thanks

  • ChatGoogleGenerativeAI doesn't support streamings to be working with tool calls.
  • CompiledGraph internally calls a stream request even when there's an ChatModel.ainvoke() in the nodes, seems like there's a two separate layer that manages LLM calls, so having ainvoke() in the node and calling CompiledGraph.astream() works fine.
  • So for the both cases where the agent is using ChatOpenAI or ChatGoogleGenerativeAI changing ChatModel.astream() into ChatModel.ainvoke() in nodes and CompiledGraph.astream() made tool calling work.
<!-- gh-comment-id:4459850618 --> @Wonder-donbury commented on GitHub (May 15, 2026): After spending an hour figuring out why tool call didn't worked with gemini-3 streaming, I found the followings. Can you please have a look and decide whether to add the following points in the relevant docs? Thanks - `ChatGoogleGenerativeAI` doesn't support streamings to be working with tool calls. - `CompiledGraph `internally calls a stream request even when there's an `ChatModel.ainvoke()` in the nodes, seems like there's a two separate layer that manages LLM calls, so having ainvoke() in the node and calling `CompiledGraph.astream()` works fine. - So for the both cases where the agent is using ChatOpenAI or `ChatGoogleGenerativeAI` changing `ChatModel.astream()` into `ChatModel.ainvoke()` in nodes and `CompiledGraph.astream() `made tool calling work.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#2773