"chat_history"], template=template)memory = ConversationBufferMemory(memory_key="chat_history")readonlymemory = ReadOnlySharedMemory(memory=memory)summary_chain = LLMChain(    llm=OpenAI(),    prompt=prompt,    verbose=True,    memory=readonlymemory,  # use the read-only memory to prevent the tool from modifying the memory)search = GoogleSearchAPIWrapper()tools = [    Tool(        name="Search",        func=search.run,        description="useful for when you need to answer questions about current events",    ),    Tool(        name="Summary",        func=summary_chain.run,        description="useful for when you summarize a conversation. The input to this tool should be a string, representing who will read this summary.",    ),]prefix = """Have a conversation with a human, answering the following questions as best you can. You have access to the following tools:"""suffix = """Begin!"{chat_history}Question: {input}{agent_scratchpad}"""prompt = ZeroShotAgent.create_prompt(    tools,    prefix=prefix,    suffix=suffix,    input_variables=["input", "chat_history", "agent_scratchpad"],)We can now construct the LLMChain, with the Memory object, and then create the agent.llm_chain = LLMChain(llm=OpenAI(temperature=0), prompt=prompt)agent = ZeroShotAgent(llm_chain=llm_chain, tools=tools, verbose=True)agent_chain = AgentExecutor.from_agent_and_tools(    agent=agent, tools=tools, verbose=True, memory=memory)agent_chain.run(input="What is ChatGPT?")            > Entering new AgentExecutor chain...    Thought: I should research ChatGPT to answer this question.    Action: Search    Action Input: "ChatGPT"    Observation: Nov 30, 2022 ... We've trained a model called ChatGPT which interacts in a conversational way. The dialogue format makes it possible for ChatGPT to answer¬†... ChatGPT is an artificial intelligence chatbot developed by OpenAI and launched in November 2022. It is built on top of OpenAI's GPT-3 family of large¬†... ChatGPT. We've trained a model called ChatGPT
This notebook goes over adding memory to both an Agent and its tools. Before going through this notebook, please walk through the following notebooks, as this will build on top of both of them:
This notebook goes over adding memory to both an Agent and its tools. Before going through this notebook, please walk through the following notebooks, as this will build on top of both of them: ->: "chat_history"], template=template)memory = ConversationBufferMemory(memory_key="chat_history")readonlymemory = ReadOnlySharedMemory(memory=memory)summary_chain = LLMChain(    llm=OpenAI(),    prompt=prompt,    verbose=True,    memory=readonlymemory,  # use the read-only memory to prevent the tool from modifying the memory)search = GoogleSearchAPIWrapper()tools = [    Tool(        name="Search",        func=search.run,        description="useful for when you need to answer questions about current events",    ),    Tool(        name="Summary",        func=summary_chain.run,        description="useful for when you summarize a conversation. The input to this tool should be a string, representing who will read this summary.",    ),]prefix = """Have a conversation with a human, answering the following questions as best you can. You have access to the following tools:"""suffix = """Begin!"{chat_history}Question: {input}{agent_scratchpad}"""prompt = ZeroShotAgent.create_prompt(    tools,    prefix=prefix,    suffix=suffix,    input_variables=["input", "chat_history", "agent_scratchpad"],)We can now construct the LLMChain, with the Memory object, and then create the agent.llm_chain = LLMChain(llm=OpenAI(temperature=0), prompt=prompt)agent = ZeroShotAgent(llm_chain=llm_chain, tools=tools, verbose=True)agent_chain = AgentExecutor.from_agent_and_tools(    agent=agent, tools=tools, verbose=True, memory=memory)agent_chain.run(input="What is ChatGPT?")            > Entering new AgentExecutor chain...    Thought: I should research ChatGPT to answer this question.    Action: Search    Action Input: "ChatGPT"    Observation: Nov 30, 2022 ... We've trained a model called ChatGPT which interacts in a conversational way. The dialogue format makes it possible for ChatGPT to answer¬†... ChatGPT is an artificial intelligence chatbot developed by OpenAI and launched in November 2022. It is built on top of OpenAI's GPT-3 family of large¬†... ChatGPT. We've trained a model called ChatGPT