Documentation Index
Fetch the complete documentation index at: https://www.adaline.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
FunctionSchema
Defines the JSON Schema for a tool or function that an LLM can invoke via function calling.
Import
import type { FunctionSchema } from '@adaline/api';
Definition
interface FunctionSchema {
name: string;
description: string;
parameters: any;
strict?: boolean | null;
}
Fields
| Field | Type | Description |
|---|
name | string | Function name. Must match ^[a-zA-Z0-9_]{1,64}$ — alphanumeric and underscores only, 1–64 characters. |
description | string | Human-readable description of what the function does. Maximum 4096 characters. The LLM uses this to decide when to call the function. |
parameters | any | A JSON Schema object describing the function’s input parameters. Typically an object schema with properties and required. |
strict | boolean | null | When true, the LLM must produce arguments that strictly conform to the parameters schema. When false or null, the LLM may produce approximate matches. |
Usage
Basic function schema
import type { FunctionSchema } from '@adaline/api';
const getWeather: FunctionSchema = {
name: 'get_weather',
description: 'Get the current weather for a given city',
parameters: {
type: 'object',
properties: {
city: {
type: 'string',
description: 'City name (e.g., "San Francisco")',
},
units: {
type: 'string',
enum: ['celsius', 'fahrenheit'],
default: 'celsius',
description: 'Temperature units',
},
},
required: ['city'],
},
strict: true,
};
FunctionSchema is used inside a ToolFunction definition:
import type { ToolFunction, FunctionSchema } from '@adaline/api';
const schema: FunctionSchema = {
name: 'search_database',
description: 'Search the internal knowledge base for relevant documents',
parameters: {
type: 'object',
properties: {
query: {
type: 'string',
description: 'Natural language search query',
},
limit: {
type: 'number',
description: 'Maximum number of results to return',
default: 10,
},
filters: {
type: 'object',
properties: {
category: { type: 'string' },
dateAfter: { type: 'string', format: 'date' },
},
},
},
required: ['query'],
},
};
const tool: ToolFunction = {
type: 'function',
definition: { schema },
};
JSON representation
{
"name": "get_weather",
"description": "Get the current weather for a given city",
"parameters": {
"type": "object",
"properties": {
"city": { "type": "string", "description": "City name" },
"units": { "type": "string", "enum": ["celsius", "fahrenheit"] }
},
"required": ["city"]
},
"strict": true
}
See Also
- ToolFunction — wraps
FunctionSchema inside a tool definition