Complete the code to import the Tool class from langchain.tools.
from langchain.tools import [1]
The Tool class is imported from langchain.tools to create custom tools for agents.
Complete the code to define a simple tool function that returns a greeting.
def greet(name: str) -> str: return f"Hello, [1]!"
The function parameter is name, so we use it inside the f-string to greet the user.
Fix the error in the tool creation by filling the missing argument for the Tool constructor.
my_tool = Tool(name="GreetTool", func=greet, description=[1])
The description argument should be a string explaining what the tool does.
Fill both blanks to create a tool list and initialize an agent with it.
tools = [[1]] agent = initialize_agent(tools=[2], agent_type="zero-shot-react-description")
The list tools contains my_tool. The agent is initialized with this list.
Fill all three blanks to define a tool function, create the tool, and add it to the tools list.
def [1](query: str) -> str: return f"Searching for: {query}" search_tool = Tool(name="Search", func=[2], description="Searches the web") tools = [[3]]
The function is named search, used as the func in the tool, and the tool is added to the list.