Bird
0
0

Which of the following is the correct way to initialize an agent with tools in Langchain?

easy📝 Syntax Q12 of 15
LangChain - Agents
Which of the following is the correct way to initialize an agent with tools in Langchain?
Aagent = initialize_agent(agent='zero-shot-react-description', tools, llm)
Bagent = initialize_agent(tools, llm, agent='zero-shot-react-description', verbose=True)
Cagent = initialize_agent(tools, llm, verbose=False, agent='react-zero-shot')
Dagent = initialize_agent(llm, tools, agent='zero-shot-react-description')
Step-by-Step Solution
Solution:
  1. Step 1: Recall initialize_agent parameter order

    The correct order is llm first, then tools, followed by named parameters like agent type.
  2. Step 2: Check each option's order and parameters

    agent = initialize_agent(llm, tools, agent='zero-shot-react-description') correctly uses llm, tools, agent type string. Others have wrong order or wrong agent name.
  3. Final Answer:

    agent = initialize_agent(llm, tools, agent='zero-shot-react-description') -> Option D
  4. Quick Check:

    initialize_agent(llm, tools, ...) correct order [OK]
Quick Trick: Remember: llm first, then tools in initialize_agent [OK]
Common Mistakes:
MISTAKES
  • Swapping llm and tools arguments
  • Using incorrect agent type strings
  • Omitting agent type parameter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes