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§

StructuredRequest
Request specification for structured object generation.
StructuredResult
Result of a successful structured generation.

Enums§

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.