func=llm_math_chain.run,        description="useful for when you need to answer questions about math",    ),    Tool(        name="FooBar-DB",        func=db_chain.run,        description="useful for when you need to answer questions about FooBar. Input should be in the form of a question containing full context",    ),]from langchain.prompts import MessagesPlaceholderfrom langchain.memory import ConversationBufferMemoryagent_kwargs = {    "extra_prompt_messages": [MessagesPlaceholder(variable_name="memory")],}memory = ConversationBufferMemory(memory_key="memory", return_messages=True)agent = initialize_agent(    tools,    llm,    agent=AgentType.OPENAI_FUNCTIONS,    verbose=True,    agent_kwargs=agent_kwargs,    memory=memory,)agent.run("hi")            > Entering new  chain...    Hello! How can I assist you today?        > Finished chain.    'Hello! How can I assist you today?'agent.run("my name is bob")            > Entering new  chain...    Nice to meet you, Bob! How can I help you today?        > Finished chain.    'Nice to meet you, Bob! How can I help you today?'agent.run("whats my name")            > Entering new  chain...    Your name is Bob.        > Finished chain.    'Your name is Bob.'PreviousXML AgentNextRunning Agent as an IteratorCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
This notebook goes over how to add memory to an OpenAI Functions agent.
This notebook goes over how to add memory to an OpenAI Functions agent. ->: func=llm_math_chain.run,        description="useful for when you need to answer questions about math",    ),    Tool(        name="FooBar-DB",        func=db_chain.run,        description="useful for when you need to answer questions about FooBar. Input should be in the form of a question containing full context",    ),]from langchain.prompts import MessagesPlaceholderfrom langchain.memory import ConversationBufferMemoryagent_kwargs = {    "extra_prompt_messages": [MessagesPlaceholder(variable_name="memory")],}memory = ConversationBufferMemory(memory_key="memory", return_messages=True)agent = initialize_agent(    tools,    llm,    agent=AgentType.OPENAI_FUNCTIONS,    verbose=True,    agent_kwargs=agent_kwargs,    memory=memory,)agent.run("hi")            > Entering new  chain...    Hello! How can I assist you today?        > Finished chain.    'Hello! How can I assist you today?'agent.run("my name is bob")            > Entering new  chain...    Nice to meet you, Bob! How can I help you today?        > Finished chain.    'Nice to meet you, Bob! How can I help you today?'agent.run("whats my name")            > Entering new  chain...    Your name is Bob.        > Finished chain.    'Your name is Bob.'PreviousXML AgentNextRunning Agent as an IteratorCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.