from ai_query import generate_text
from ai_query.providers import xai, tool, Field
@tool(description="Get weather")
async def get_weather(location: str = Field(description="City")) -> str:
return f"Weather in {location}: 72°F, sunny"
result = await generate_text(
model=xai("grok-2-1212"),
prompt="What is the weather in SF?",
tools={"get_weather": get_weather}
)