Overview
The structured-output package deliberately avoids a single global settings object. Configuration is split across purpose-specific classes, keeping request configuration local and shared behavior reusable.Configuration Classes
LLMConfig
Holds provider connection settings: API URL, API key, model name, driver, token
limits, and provider-specific options.
StructuredOutputConfig
Controls the structured-output behavior: output mode, retry settings, prompt
templates, schema naming, and response caching.
StructuredOutputRuntime
Assembles the runtime by combining an inference provider, event dispatcher,
structured-output config, and optional pipeline customizations:
Why No Global Settings?
Splitting configuration serves several goals:- Locality — each request can use a different provider or different retry settings without affecting other requests.
- Testability — configuration objects are plain value objects that can be constructed in tests without touching global state.
- Composability — the same
LLMConfigcan be shared across the structured-output package, the Polyglot inference layer, and other companions without coupling them together. - Immutability — both
LLMConfigandStructuredOutputConfigare immutable. Mutation methods return new instances, making configuration safe to share across concurrent or reentrant code paths.