Structured Object Generator
class StructuredObjectGenerator<RESULT>(model: LanguageModel, schema: Schema<RESULT>, config: CallConfig = CallConfig(), schemaName: String = "object", schemaDescription: String? = null)(source)
Wires a LanguageModel to the structured-object machinery: constrains the model to emit JSON for schema, streams its text deltas into StructuredObject.phases (the shared parse/validate loop), and surfaces typed partials/value. Mirrors TextGenerator — a PascalCase class, not a camelCase top-level generateObject/streamObject.
Since
0.3.0-beta01
Constructors
Link copied to clipboard
constructor(model: LanguageModel, schema: Schema<RESULT>, config: CallConfig = CallConfig(), schemaName: String = "object", schemaDescription: String? = null)
Functions
Link copied to clipboard
One-shot: drives the stream to StructuredObjectPhase.Done and returns the typed result.
Link copied to clipboard
Cold stream of phases: accumulating StructuredObjectPhase.Streaming partials terminating in a single StructuredObjectPhase.Done. An in-band StreamEvent.Error from the model is surfaced (not silently dropped) so a provider failure can't masquerade as an empty object.