= """You are a chatbot having a conversation with a human.Given the following extracted parts of a long document and a question, create a final answer.{context}{chat_history}Human: {human_input}Chatbot:"""prompt = PromptTemplate(    input_variables=["chat_history", "human_input", "context"], template=template)memory = ConversationBufferMemory(memory_key="chat_history", input_key="human_input")chain = load_qa_chain(    OpenAI(temperature=0), chain_type="stuff", memory=memory, prompt=prompt)query = "What did the president say about Justice Breyer"chain({"input_documents": docs, "human_input": query}, return_only_outputs=True)    {'output_text': ' Tonight, I‚Äôd like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer‚Äîan Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service.'}print(chain.memory.buffer)        Human: What did the president say about Justice Breyer    AI:  Tonight, I‚Äôd like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer‚Äîan Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service.PreviousMemory in LLMChainNextMemory in AgentCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Most memory objects assume a single input. In this notebook, we go over how to add memory to a chain that has multiple inputs. We will add memory to a question/answering chain. This chain takes as inputs both related documents and a user question.
Most memory objects assume a single input. In this notebook, we go over how to add memory to a chain that has multiple inputs. We will add memory to a question/answering chain. This chain takes as inputs both related documents and a user question. ->: = """You are a chatbot having a conversation with a human.Given the following extracted parts of a long document and a question, create a final answer.{context}{chat_history}Human: {human_input}Chatbot:"""prompt = PromptTemplate(    input_variables=["chat_history", "human_input", "context"], template=template)memory = ConversationBufferMemory(memory_key="chat_history", input_key="human_input")chain = load_qa_chain(    OpenAI(temperature=0), chain_type="stuff", memory=memory, prompt=prompt)query = "What did the president say about Justice Breyer"chain({"input_documents": docs, "human_input": query}, return_only_outputs=True)    {'output_text': ' Tonight, I‚Äôd like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer‚Äîan Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service.'}print(chain.memory.buffer)        Human: What did the president say about Justice Breyer    AI:  Tonight, I‚Äôd like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer‚Äîan Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service.PreviousMemory in LLMChainNextMemory in AgentCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.