LangChain Tools: Extending AI Capabilities

Tools give LLMs access to external functions and APIs.

Create and use custom tools in LangChain.

Built-in Tools

✅ Web Search

✅ Calculator

✅ Python REPL

✅ File operations

Custom Tool Example

from langchain.tools import BaseTool

class WeatherTool(BaseTool):

name = “weather”

description = “Get weather for a location”

def _run(self, location: str):

# API call to weather service

return f”Weather in {location}: Sunny”

Tool Integration

Add tools to agents for enhanced capabilities.

Conclusion

Tools extend what LLMs can do!

Leave a Comment