Replies: 4 comments 2 replies
-
Hey @yhygta, back for more LangChain adventures, I see! 🚀 Based on the context provided, it seems like you're looking to clear the state in LangGraph. However, the term "LangGraph" is not explicitly defined in the LangChain framework. It's inferred that you might be referring to the If you're referring to the If you're referring to the However, if you're looking to clear the state of a conversation, you can do so by calling the memory.chat_memory.clear() This line of code effectively clears the state by removing all messages from the If you're looking to clear the state of the message_history = SingleStoreDBChatMessageHistory(session_id="my-session", host="127.0.0.1", port=3306, user="user", password="password", database="db")
message_history.clear() This will clear all messages associated with the Please note that clearing the state can have several potential side effects or consequences such as loss of cached data, performance impact, cost implications, concurrency considerations, and keyword arguments impact. If none of these solutions apply to your situation, could you please provide more details about what you mean by "clearing the state in LangGraph"? This will help me provide a more accurate solution. Sources
|
Beta Was this translation helpful? Give feedback.
-
Ideally, we should call a function in the In the meantime, I call the def clear_memory(memory: BaseCheckpointSaver, thread_id: str) -> None:
checkpoint = empty_checkpoint()
memory.put(config={"configurable": {"thread_id": thread_id}}, checkpoint=checkpoint, metadata={})
# Calling the function
memory = SqliteSaver.from_conn_string("checkpoints.sqlite")
app = graph.compile(checkpointer=memory)
clear_memory(memory=memory, thread_id="123456") |
Beta Was this translation helpful? Give feedback.
-
It there a way to clear one variable of the state ..? Rather reset the whole state |
Beta Was this translation helpful? Give feedback.
-
Hello, any updates on this matter? |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
How to clear state in langgraph?
System Info
python 3.10
Beta Was this translation helpful? Give feedback.
All reactions