Skip to main content

Module structured

Module structured 

Source
Expand description

Structured object generation from LLM output.

Provides reliable JSON object generation with schema validation, automatic repair, and streaming partial object support. Works across all providers by selecting the best available mode (strict JSON schema, json_mode, tool-call, or prompt-only).

Structs§

StructuredDirective
Instruction telling a provider how to enforce structured output for a call.
StructuredRequest
Request specification for structured object generation.
StructuredResult
Result of a successful structured generation.

Enums§

NativeStructuredSupport
Provider-native structured-output capability.
ResponseFormat
A native response_format request for OpenAI-compatible providers.
StructuredMode
Mode selection for structured output generation.

Functions§

extract_json_value
Extract a JSON value from potentially dirty LLM output.
generate_blocking
Generate a structured JSON object using the given LLM client.
generate_streaming
Generate a structured JSON object with streaming partial updates.

Type Aliases§

PartialObjectCallback
Callback for streaming partial object snapshots.