Memory is the component that lets chains remember previous conversations. ConversationBufferMemory stores the chat history in a single variable.
python
from langchain.memory import ConversationBufferMemory
# Setup memory
memory = ConversationBufferMemory()
# Add memory to an LLMChain
chain = LLMChain(llm=llm, prompt=prompt, memory=memory)
# The first time, the memory is empty.
# The second time, the chain will "remember" the first conversation.You should see
(With Memory in place, a chatbot can recall what was said earlier in the conversation.)