Skip to main content

Module schema

Module schema 

Source
Expand description

Constrained sampling for tools: strict JSON-schema parameters, and OpenAI grammar-constrained custom tools.

Structs§

Grammar
How to send a tool as an OpenAI grammar-constrained custom tool.
GrammarInput
A grammar tool call’s raw input as it streams, re-encoded as the JSON text of its arguments object.

Functions§

grammar_input
The raw input of a grammar tool call, from the argument that holds it.
grammar_properties
The tools a transcript declares that are sent with a grammar, by name, with the argument that holds each one’s raw input. messages is the transcript as the provider receives it, after resolve_transcript: a model that folds later system messages into the first one sees only the current tools.
grammar_sampling
The grammar to send tool with: it asks for one and the provider supports OpenAI grammar tools. Lark is preferred over regex. Err when the tool asks for a grammar it cannot use.
make_strict
The schema rewritten for strict mode: every property required, optional ones nullable, no additional properties. Err names the unsupported construct.
strict_sampling
Whether to send tool with strict JSON-schema sampling: it asks for it, the provider supports it and the schema can be made strict. Err when the tool requires strict sampling that cannot be had.
tool_parameters
The parameters to send: strict when strict, as declared otherwise.

Type Aliases§

KeywordCheck
A provider’s extra keyword restrictions: (key, value) is unsupported.