Tool Calling
- We want llms to help us in making
- a right choice to do actions
- To perform action we create a tool
- llms will help us in selecting a right tool
- Note: (LLMs will not call tools directly)
- Langchain gives two basic features
- bind_tools => we pass tool information to llm
- ToolMessage => llm response on which tool has to be called.
- Defining a tool: A tool at its very basic level is a simple python function
from langchain_core.tools import tool
@tool
def <function-name>(args) -> Type:
"""Docstring
"""
....
....
return something
@toolregisters the tooltype hintsdefine schema-
docstringsguide llm -
Refer Here for example usages
Langchain supports create_agent
- This uses langgraph under the hood
-
Refer Here for basic structure
-
Refer Here to view create_agent usage
