LangChain 1 · Agents and tools
Define a tool
Turn a function into a tool. The docstring tells the model when to use it.
from langchain.tools import tool
@tool
def get_weather(city: str) -> str:
"""Get the current weather for a city."""
return f"It is sunny in {city}."
Official LangChain 1 documentation