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§
- Structured
Directive - Instruction telling a provider how to enforce structured output for a call.
- Structured
Request - Request specification for structured object generation.
- Structured
Result - Result of a successful structured generation.
Enums§
- Native
Structured Support - Provider-native structured-output capability.
- Response
Format - A native
response_formatrequest for OpenAI-compatible providers. - Structured
Mode - 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§
- Partial
Object Callback - Callback for streaming partial object snapshots.