FunctionSchema
Defines the JSON Schema for a tool or function used in LLM function calling.Overview
FunctionSchema describes a callable function that an LLM can invoke, including its name, description, parameter schema, and optional strict validation mode. It is used inside ToolFunction definitions.
Import
Fields
Function name. Must match the pattern
^[a-zA-Z0-9_]{1,64}$ — alphanumeric characters and underscores only, between 1 and 64 characters.A human-readable description of what the function does. Maximum 4096 characters. This is provided to the LLM to help it decide when and how to call the function.
A JSON Schema object describing the function’s parameters. Must have
"type": "object" at the top level with "properties" defining each parameter.Whether to enforce strict schema validation. When
True, the LLM must conform exactly to the parameter schema — no extra properties or missing required fields. When None or False, the LLM may produce approximate matches.Usage
Basic function schema
Using within a ToolFunction
JSON Representation
Name Validation
Thename field must match the regex pattern ^[a-zA-Z0-9_]{1,64}$:
| Example | Valid |
|---|---|
"get_weather" | Yes |
"searchDB" | Yes |
"my_function_v2" | Yes |
"get-weather" | No — hyphens not allowed |
"get weather" | No — spaces not allowed |
"" | No — must be at least 1 character |
Related
- ToolFunction — wraps
FunctionSchemain a tool definition