Bird
0
0

Which of the following is the correct way to create a tool in Langchain?

easy📝 Syntax Q12 of 15
LangChain - Agents
Which of the following is the correct way to create a tool in Langchain?
Atool = Tool(func=search_function)
Btool = Tool('search', description='Searches data')
Ctool = Tool(name='search', description='Searches data')
Dtool = Tool(name='search', func=search_function, description='Searches data')
Step-by-Step Solution
Solution:
  1. Step 1: Check required parameters for Tool

    The Tool constructor needs a name, a function (func), and a description.
  2. Step 2: Match parameters with options

    Only tool = Tool(name='search', func=search_function, description='Searches data') provides all three: name, func, and description correctly.
  3. Final Answer:

    tool = Tool(name='search', func=search_function, description='Searches data') -> Option D
  4. Quick Check:

    Tool needs name, func, description = C [OK]
Quick Trick: Tool needs name, function, and description to work [OK]
Common Mistakes:
MISTAKES
  • Omitting the function parameter
  • Passing parameters in wrong order
  • Leaving out the description

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes