Function calling
Send OpenAI-style tools and optional tool_choice on chat completions. The model must list tools under supported_parameters in GET /v1/models.
400 if the model has no tools
A model without
tools in the catalog returns 400 invalid_request with the message that it does not support tool calls. Retrying will not help. Pick another model or drop the field.Example
terminal
curl https://api.astorias.ai/v1/chat/completions \
-H "Authorization: Bearer $ASTORIAS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "{huggingface-model-id}",
"messages": [{"role": "user", "content": "What is the weather in Agra?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Look up weather by city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}]
}'After a tool call, send a follow-up message with role tool and the function result, the same way you would against OpenAI.