Tool calling
Give the model functions your code runs.
Define functions in tools. When the model wants one, it answers with a tool call instead of text; your code runs the function and sends the result back in the next request. Raon passes your tools to the model as they are and runs none of them itself, apart from web search.
import json
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
},
}]
messages = [{"role": "user", "content": "What is the weather in Seoul?"}]
completion = client.chat.completions.create(model="raon-1-mini-preview", messages=messages, tools=tools)
message = completion.choices[0].message
if message.tool_calls:
messages.append(message)
for call in message.tool_calls:
args = json.loads(call.function.arguments)
result = {"city": args["city"], "temperature_c": 18} # your function here
messages.append({"role": "tool", "tool_call_id": call.id, "content": json.dumps(result)})
completion = client.chat.completions.create(model="raon-1-mini-preview", messages=messages, tools=tools)
print(completion.choices[0].message.content)The same flow works on Responses (function_call and function_call_output items) and on Messages (tool_use and tool_result blocks), in each API's own shape.
Tips
- Describe each function and its parameters plainly. The model picks tools from these descriptions.
- When an agent should always act through tools, say so in the system prompt. Some agents expect a tool call on every turn.
- On Messages,
tool_choicetakesauto,anyornone; naming one tool returns 400.

