is Bob.        > Finished chain.    'Your name is Bob.'agent_executor.invoke({"input": "what are some movies showing 9/21/2023?"})['output']            > Entering new AgentExecutor chain...        Thought: Do I need to use a tool? Yes    Action: Current Search    Action Input: Movies showing 9/21/2023['September 2023 Movies: The Creator ‚Ä¢ Dumb Money ‚Ä¢ Expend4bles ‚Ä¢ The Kill Room ‚Ä¢ The Inventor ‚Ä¢ The Equalizer 3 ‚Ä¢ PAW Patrol: The Mighty Movie, ...'] Do I need to use a tool? No    Final Answer: According to current search, some movies showing on 9/21/2023 are The Creator, Dumb Money, Expend4bles, The Kill Room, The Inventor, The Equalizer 3, and PAW Patrol: The Mighty Movie.        > Finished chain.    'According to current search, some movies showing on 9/21/2023 are The Creator, Dumb Money, Expend4bles, The Kill Room, The Inventor, The Equalizer 3, and PAW Patrol: The Mighty Movie.'Use the off-the-shelf agent‚ÄãWe can also create this agent using the off-the-shelf agent classagent_executor = initialize_agent(tools, llm, agent=AgentType.CONVERSATIONAL_REACT_DESCRIPTION, verbose=True, memory=memory)Use a chat model‚ÄãWe can also use a chat model here. The main difference here is in the prompts used.from langchain.chat_models import ChatOpenAIfrom langchain import hubprompt = hub.pull("hwchase17/react-chat-json")chat_model = ChatOpenAI(temperature=0, model='gpt-4')prompt = prompt.partial(    tools=render_text_description(tools),    tool_names=", ".join([t.name for t in tools]),)chat_model_with_stop = chat_model.bind(stop=["\nObservation"])from langchain.agents.output_parsers import JSONAgentOutputParserfrom langchain.agents.format_scratchpad import format_log_to_messages# We need some extra steering, or the chat model forgets how to respond sometimesTEMPLATE_TOOL_RESPONSE = """TOOL RESPONSE: ---------------------{observation}USER'S INPUT--------------------Okay, so what is the response to my last comment? If using information obtained from the tools you
This walkthrough demonstrates how to use an agent optimized for conversation. Other agents are often optimized for using tools to figure out the best response, which is not ideal in a conversational setting where you may want the agent to be able to chat with the user as well.
This walkthrough demonstrates how to use an agent optimized for conversation. Other agents are often optimized for using tools to figure out the best response, which is not ideal in a conversational setting where you may want the agent to be able to chat with the user as well. ->: is Bob.        > Finished chain.    'Your name is Bob.'agent_executor.invoke({"input": "what are some movies showing 9/21/2023?"})['output']            > Entering new AgentExecutor chain...        Thought: Do I need to use a tool? Yes    Action: Current Search    Action Input: Movies showing 9/21/2023['September 2023 Movies: The Creator ‚Ä¢ Dumb Money ‚Ä¢ Expend4bles ‚Ä¢ The Kill Room ‚Ä¢ The Inventor ‚Ä¢ The Equalizer 3 ‚Ä¢ PAW Patrol: The Mighty Movie, ...'] Do I need to use a tool? No    Final Answer: According to current search, some movies showing on 9/21/2023 are The Creator, Dumb Money, Expend4bles, The Kill Room, The Inventor, The Equalizer 3, and PAW Patrol: The Mighty Movie.        > Finished chain.    'According to current search, some movies showing on 9/21/2023 are The Creator, Dumb Money, Expend4bles, The Kill Room, The Inventor, The Equalizer 3, and PAW Patrol: The Mighty Movie.'Use the off-the-shelf agent‚ÄãWe can also create this agent using the off-the-shelf agent classagent_executor = initialize_agent(tools, llm, agent=AgentType.CONVERSATIONAL_REACT_DESCRIPTION, verbose=True, memory=memory)Use a chat model‚ÄãWe can also use a chat model here. The main difference here is in the prompts used.from langchain.chat_models import ChatOpenAIfrom langchain import hubprompt = hub.pull("hwchase17/react-chat-json")chat_model = ChatOpenAI(temperature=0, model='gpt-4')prompt = prompt.partial(    tools=render_text_description(tools),    tool_names=", ".join([t.name for t in tools]),)chat_model_with_stop = chat_model.bind(stop=["\nObservation"])from langchain.agents.output_parsers import JSONAgentOutputParserfrom langchain.agents.format_scratchpad import format_log_to_messages# We need some extra steering, or the chat model forgets how to respond sometimesTEMPLATE_TOOL_RESPONSE = """TOOL RESPONSE: ---------------------{observation}USER'S INPUT--------------------Okay, so what is the response to my last comment? If using information obtained from the tools you