Documentation Index
Fetch the complete documentation index at: https://docs.neuroa.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Tool calling allows models to call external functions or APIs, enabling dynamic, structured workflows inside chat interactions.
βοΈ How It Works
- Define Tools β Provide a list of available tools with names, descriptions, and parameters.
- Start Chat β Send user messages as usual.
- Receive Tool Call β The model may decide to call a tool based on context.
- Execute Tool β Your backend runs the function and returns the result.
- Continue Chat β Pass the result back into the conversation for further interaction.
{
"tools": [
{
"type": "function",
"function": {
"name": "getWeather",
"description": "Get the current weather for a city.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City and country, e.g., 'Paris, France'"
}
},
"required": ["location"]
}
}
}
]
}
π€ Request Example
{
"model": "openai/gpt-4o",
"messages": [
{ "role": "user", "content": "What's the weather in Tokyo?" }
],
"tools": [ ... ],
"tool_choice": "auto"
}
Field Type Required Description
tools object[] β
Array of tool definitions
tool_choice string β
βautoβ lets the model decide when to invoke tools
π¨ Tool Call Response Example
{
"choices": [
{
"message": {
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call-abc",
"type": "function",
"function": {
"name": "getWeather",
"arguments": "{\"location\":\"Tokyo, Japan\"}"
}
}
]
}
}
]
}
π Note: You need to parse arguments and execute the function.
π Returning Tool Result
{
"role": "tool",
"tool_call_id": "call-abc",
"content": "{\"temperature\":\"28Β°C\",\"condition\":\"Sunny\"}"
}
The model will continue responding based on the toolβs output.
β
Best Practices
β’ Define clear descriptions for tools to guide the model.
β’ Use JSON Schema for input validation.
β’ Handle errors gracefully and provide fallback messages if needed.
β’ Log all tool calls for monitoring and debugging.