Skip to main content

ToolFunction

Types for defining tools, functions, and their execution configurations.

Overview

Tool types define how LLMs can call external functions, including schemas, parameters, HTTP configurations, and retry logic.

ToolFunction

Tool function definition with schema and optional HTTP request configuration.

Fields

type
str
required
Must be "function".
definition
ToolFunctionDefinition
required
The function definition containing the schema. See ToolFunctionDefinition.
request
FunctionRequestHttp | None
Optional HTTP request configuration for executing the function via REST API. See FunctionRequestHttp.

Example


ToolFunctionDefinition

See the dedicated ToolFunctionDefinition page for full documentation. Wrapper for a function schema within a tool definition.

Fields

var_schema
FunctionSchema
required
The function schema. Aliased as schema in JSON — use var_schema in Python to avoid collision with the Python reserved word.

Example


FunctionSchema

See the dedicated FunctionSchema page for full documentation. Function/tool schema definition for LLM function calling.

Fields

name
str
required
Function name. Must match ^[a-zA-Z0-9_]{1,64}$ (alphanumeric and underscores, max 64 chars).
description
str
required
Description of what the function does. Max 4096 characters.
parameters
dict[str, Any]
required
JSON Schema object describing the function parameters.
strict
bool | None
Whether to enforce strict schema validation. When True, the LLM must conform exactly to the parameter schema.

Example

JSON:

FunctionRequestHttp

HTTP request configuration for executing functions via REST API.

Fields

type
str
required
Must be "http".
method
str
required
HTTP method. One of: "get", "post".
url
str
required
The request URL. Supports {{variable}} template syntax.
headers
dict[str, str] | None
Optional HTTP headers.
query
dict[str, str] | None
Optional query parameters.
body
dict[str, Any] | None
Optional request body.
proxy_url
str | None
Optional proxy URL.
proxy_headers
dict[str, str] | None
Optional proxy headers.
retry
FunctionRequestRetry | None
Optional retry configuration. See FunctionRequestRetry.

Example


FunctionRequestRetry

Retry configuration with exponential backoff.

Fields

max_attempts
int
required
Maximum number of retry attempts. Minimum: 1.
initial_delay
int
required
Initial delay in milliseconds. Minimum: 1.
exponential_factor
int
required
Multiplier for each subsequent retry. Minimum: 1.

Example


Complete Example

Using Tools from a Deployment