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

str
required
Must be "function".
ToolFunctionDefinition
required
The function definition containing the schema. See ToolFunctionDefinition.
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

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

str
required
Function name. Must match ^[a-zA-Z0-9_]{1,64}$ (alphanumeric and underscores, max 64 chars).
str
required
Description of what the function does. Max 4096 characters.
dict[str, Any]
required
JSON Schema object describing the function parameters.
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

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

Example


FunctionRequestRetry

Retry configuration with exponential backoff.

Fields

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

Example


Complete Example

Using Tools from a Deployment