Complete the code to import the OpenAI functions agent from LangChain.
from langchain_community.agents import [1]
The OpenAIFunctionsAgent is the correct import to create an agent that uses OpenAI functions in LangChain.
Complete the code to create an OpenAI chat model with temperature 0.
from langchain_openai import ChatOpenAI chat = ChatOpenAI(temperature=[1])
Setting temperature=0 makes the model deterministic, which is common for function calling agents.
Fix the error in the code to create an OpenAI functions agent with the chat model and tools.
agent = OpenAIFunctionsAgent.from_llm_and_tools([1], tools)The variable 'chat' is the ChatOpenAI instance passed to the agent constructor.
Fill both blanks to create a list of tools and initialize the agent executor.
tools = [[1]] agent_executor = AgentExecutor(agent=agent, tools=[2])
The tools list contains 'tool' and the AgentExecutor uses the 'tools' list as argument.
Fill all three blanks to run the agent executor with input and print the output.
input_text = [1] output = agent_executor.run([2]) print([3])
We assign a string to input_text, run the agent with input_text, and print the output variable.