llmgleam/schema

Types

The top-level object schema for a function’s arguments.

Every property is required and additional properties are disabled, making these parameters compatible with strict tool schemas. Use nullable when a required argument may have no value.

pub opaque type Parameters

A named property in an object schema.

pub opaque type Property

A type-safe subset of JSON Schema supported by function tools.

pub opaque type Schema

Values

pub fn array(items: Schema) -> Schema

Creates an array schema.

pub fn boolean() -> Schema

Creates a boolean schema.

pub fn described(schema: Schema, description: String) -> Schema

Adds a description to any schema.

pub fn integer() -> Schema

Creates an integer schema.

pub fn nullable(schema: Schema) -> Schema

Allows a schema’s value to be null.

pub fn number() -> Schema

Creates a number schema.

pub fn object(properties: List(Property)) -> Schema

Creates an object schema.

Every property is required and additional properties are disabled.

pub fn parameters(properties: List(Property)) -> Parameters

Creates the top-level parameters for a function tool.

pub fn property(name: String, schema: Schema) -> Property

Creates a named object property.

pub fn string() -> Schema

Creates a string schema.

pub fn string_enum(first: String, rest: List(String)) -> Schema

Creates a string schema restricted to one or more values.

pub fn to_gemini_json(parameters: Parameters) -> json.Json

Encodes typed function parameters for Gemini’s OpenAPI schema subset.

pub fn to_json(parameters: Parameters) -> json.Json

Encodes typed function parameters as strict JSON Schema.

✨ Search Document