Adding graph memory
Excellent! Your chatbot can use Wikipedia to answer questions based on the the user's query. Now you can take things a step further by allowing your users to ask follow up questions! To do this, you'll first need to enable memory within your chatbot. Memory will allow your chatbot access to the full context of the conversation so it can handle follow up conversations.
Deze oefening maakt deel uit van de cursus
Designing Agentic Systems with LangChain
Oefeninstructies
- Start by importing
MemorySaverfrom thecheckpoint.memorymodule in LangGraph. - Create an instance of
MemorySaver()asmemory. - Compile the chatbot graph again by setting the
checkpointerargument tomemoryin the.compile()method applied tograph_builder.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Import the modules for saving memory
from langgraph.____.____ import ____
# Modify the graph with memory checkpointing
memory = ____()
# Compile the graph passing in memory
graph = ____.___(checkpointer=____)