The @tool Decorator
Basic Usage
from djangosdk.tools.decorator import tool
@tool
def get_weather(city: str, unit: str = "celsius") -> str:
"""Get the current weather for a city.
Args:
city: The city name to look up.
unit: Temperature unit, either celsius or fahrenheit.
"""
return f"Sunny, 22°C in {city}"Supported Type Annotations
Python type
JSON schema type
Required vs. Optional Parameters
Using a Tool in an Agent
Inspecting the Generated Schema
Async Tools
Last updated
Was this helpful?