Guides
Tool use
This is not available on this model yet. The model object's capabilities.tools turns true when it is.
What it is for
Antarya cannot look up your calendar or open your database. With tools, you describe a function; when she needs it, the reply contains a request to call it. You run the function and send the result back, and she finishes the answer.
The loop
- Send the question with
tools, a list of functions you describe. - If the reply has a
tool_callpart, run that function with itsinput. - Send the conversation again, with the reply added and a
toolmessage holding the result. - Repeat until
stop_reasonisend_turn.
curl https://antarya.ai/v1/chat \
-H "Authorization: Bearer $ANTARYA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "Draft a reply that declines the meeting."}
],
"tools": [
{
"name": "get_free_slots",
"description": "Return the free calendar slots for a given week.",
"input_schema": {
"type": "object",
"properties": {"week": {"type": "string"}},
"required": ["week"]
}
}
],
"tool_choice": {"type": "auto"}
}'Output
{
"id": "req_06",
"content": [
{"type": "tool_call", "id": "call_01", "name": "get_free_slots", "input": {"week": "next"}}
],
"stop_reason": "tool_call",
"usage": {"input_tokens": 88, "output_tokens": 21}
}The output shows the first reply, the one that asks for the function. After you send the result, the next reply has stop_reason of end_turn and holds the answer as text.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
tools | array | No | The functions she may ask you to call. |
name | text | YesRequired | A short name for the function. |
description | text | YesRequired | What the function does and when to use it. She reads this to decide. |
input_schema | object | YesRequired | A JSON schema for the function's input. |
tool_choice | object | No | How freely she may use tools. `auto` lets her decide and is the default, `none` stops her using tools, `any` makes her use one, and {"type": "tool", "name": "..."} makes her use that tool. |