# Tools

Page: https://galatea.co/api/docs/tools

Let the model call your functions. You run the function and send the result back.

Pass tools with a function name, a description and a JSON Schema for the parameters. When the model wants a function, the answer has finish_reason tool_calls and a tool_calls array with the function name and its arguments as a JSON string.

```python
import json, os
from openai import OpenAI

client = OpenAI(base_url="https://api.galatea.co/v1", api_key=os.environ["GALATEA_API_KEY"])
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Current weather for a city.",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]
reply = client.chat.completions.create(
    model="deepseek-v4.1-flash-1017-uncensored",
    messages=[{"role": "user", "content": "What is the weather in Austin?"}],
    tools=tools,
    tool_choice="auto",
)
call = reply.choices[0].message.tool_calls[0]
print(call.function.name, json.loads(call.function.arguments))
```

Run the function yourself, then append the assistant message and one tool message per call, with the matching tool_call_id, and call the endpoint again. tool_choice accepts none, auto, required, or an object that names one function.

Set strict to true on a function to have the arguments follow its schema exactly.
