Get startedGet started for free

Binding multiple tools

You've just built multiple tools! Now you'll be able to add them to your chatbot by first binding them to the LLM. The tools wikipedia_tool, palindrome_checker and historical_events have all been added to your environment along with llm. You'll also create a tool node to add to your chatbot that lists all of the tools available.

This exercise is part of the course

Designing Agentic Systems with LangChain

View Course

Exercise instructions

  • From langgraph.prebuilt, import the necessary module for defining a tool node.
  • Complete the list of tools by adding the appropriate tool names present in your environment.
  • Pass the list of tools to the ToolNode() class and assign it to tool_node.
  • Bind the tools to the llm using .bind_tools().

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Import modules required for defining tool nodes
from ____.____ import ____

# List of tools
tools = [____, ____, ____]

# Pass the tools to the ToolNode()
____ = ____(____)

# Bind tools to the LLM
model_with_tools = ____.____(____)
Edit and Run Code