How to retrieve and use the stored memory in Langgraph? #1176
Replies: 2 comments
-
hi @Jayapradha05 . could you please provide some additional code with how you're trying to retrieve chat memory (full graph definition + how you're invoking it)? i am assuming that by "chat history" you mean accessing as long as you invoke your graph with graph.invoke({"messages": [("human", "hi")]}) if you want to retrieve the values of the state after the graph finishes executtion, you would need to also provide a checkpointer to your graph, see more examples here https://langchain-ai.github.io/langgraph/how-tos/persistence/ to answer your second question -- |
Beta Was this translation helpful? Give feedback.
-
Hi @vbarda Full Graph Structure and Invocation Method
The Issue User Input: "Can you tell me which food is famous in Japan?" Could you please provide insights on how to ensure that the state, especially messages, is preserved and utilized correctly across multiple interactions? Do I need to adjust the way I'm invoking the graph or modify the AgentState definition to maintain the context better? Thank you for your assistance! |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I'm having an issue with using TypedDict and Annotated for storing chat history in a class. When I define my AgentState class like this, I can retrieve the chat history without any problems:
However, when I extend the AgentState class to include more fields, I'm unable to retrieve the chat memory:
In this case, I can no longer retrieve the chat memory. Does anyone know why this might be happening and how I can fix it? Any help would be greatly appreciated!
Additionally, I'd like to understand how the AgentState handles input. When I pass the input to the agent, how is it processed and stored within the AgentState structure? Any insights or explanations on the internal workings would be very helpful.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions