Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Tool Use/Function Calling

Crynux AS supports the OpenAI-compatible function tool API on /chat/completions and /responses. You describe functions to the model, and the model can return one or more function calls with JSON arguments.

Replace <endpoint_token> and your-api-key with your project endpoint token and API key from Crynux AS.

Supported Parameters

Crynux supports function tools only:

{
  "type": "function",
  "function": {
    "name": "get_current_weather",
    "description": "Get the current weather in a given location",
    "parameters": {
      "type": "object",
      "properties": {
        "location": {"type": "string"},
        "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
      },
      "required": ["location"]
    },
    "strict": true
  }
}

tool_choice

Behavior

"none"

Tools may still be sent to the chat template. No tool grammar is applied.

"auto"

The model may return normal text or tool calls. A tool grammar is applied only when at least one declared function has strict: true.

"required"

The model must produce at least one tool call.

{"type":"function","function":{"name":"..."}}

The model must call the named function.

Limits and unsupported fields:

  • Built-in tools such as web search are rejected.

  • parallel_tool_calls is ignored on Crynux models.

  • Legacy functions / function_call are not supported.

  • If an active tool constraint and response_format / text.format are both present, the tool constraint takes precedence.

On /chat/completions, Crynux AS parses the model raw text into OpenAI message.tool_calls and sets finish_reason to tool_calls when a call is detected. The Raw Task download API does not perform that conversion.

Chat Completions with the OpenAI SDK

Complete Tool Loop

A useful application usually executes the returned function, appends the tool result, and asks the model again for the final answer:

LangChain

Responses API

Responses uses a flat function tool shape and returns function_call output items. Continue the conversation with function_call_output items, or use previous_response_id. See Responses API.

Raw Task API

Raw Task GPTTaskArgs accepts the same tools and tool_choice fields. The download result keeps tool-call syntax in choices[].message.content and does not populate OpenAI message.tool_calls. Prefer /chat/completions or /responses when you need the parsed OpenAI tool-call objects. See Text-to-Text Task.

Parameter Details

tools

tools is the list of functions the model may call. Crynux accepts only OpenAI-style function tools:

  • type must be "function"

  • function.name is required and must be unique in the list

  • function.description and function.parameters are optional

  • function.strict is optional; see below

Built-in tools such as web search are not supported. Legacy functions / function_call fields are not supported. parallel_tool_calls is ignored on Crynux models.

tool_choice

tool_choice controls whether the model must call a tool, and how strongly Crynux constrains generation:

  • "none": do not require a tool call. Tools may still be passed into the chat template, but no tool grammar is applied. Use this on the final turn after you already have tool results.

  • "auto": the model may return normal text or tool calls. Crynux applies a tool grammar only when at least one declared function has strict: true. If every tool omits strict or sets strict: false, generation is not forced into valid tool-call syntax.

  • "required": the request must declare at least one tool, and generation is constrained to include at least one tool call.

  • Named function, Chat Completions shape: {"type":"function","function":{"name":"get_current_weather"}}. Generation is constrained to that function. Responses uses the flat shape {"type":"function","name":"get_current_weather"}.

If an active tool constraint and response_format / text.format are both present, the tool constraint takes precedence and structured output is ignored.

strict

function.strict is a per-tool boolean:

  • With tool_choice="auto", at least one strict: true tool is required before Crynux enables the tool grammar.

  • When a tool grammar is active, strict is also passed into that grammar so function arguments follow the declared parameter schema more closely.

  • strict is not a global switch that forces every tool to be called.

Response fields

On /chat/completions, Crynux AS parses successful tool-call syntax into message.tool_calls and sets finish_reason to tool_calls. On /responses, parsed calls appear as function_call output items. Set max_tokens / max_output_tokens high enough for a complete call; a finish_reason="length" result may contain an incomplete tool-call prefix.

Last updated