Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

StructuredOutputCompleteEvent.md

107 lines2.0 KB

Interface: StructuredOutputCompleteEvent<T>

Defined in: packages/typescript/ai/src/types.ts:1168

Final event of a streaming structured-output run. Carries the validated object (typed as T after the orchestrator runs Standard Schema parsing), the raw JSON text that produced it, and — for thinking/reasoning models — the accumulated reasoning text. Adapters emit this with T = unknown; the chat orchestrator narrows to the schema's inferred type after validation.

reasoning is undefined when the model produced none (most non-thinking models) and when the underlying adapter doesn't expose reasoning streams.

name is a string literal so consumers can narrow directly:

if (chunk.type === 'CUSTOM' && chunk.name === 'structured-output.complete') {
  chunk.value.object // typed as T
}

Extends

Type Parameters

T

T = unknown

Indexable

[k: string]: unknown

Properties

model?

optional model: string;

Defined in: packages/typescript/ai/src/types.ts:1147

Model identifier for multi-model support

Inherited from

CustomEvent.model


name

name: "structured-output.complete";

Defined in: packages/typescript/ai/src/types.ts:1171

Overrides

CustomEvent.name

value

value: object;

Defined in: packages/typescript/ai/src/types.ts:1172

object

object: T;

raw

raw: string;

reasoning?

optional reasoning: string;

Overrides

CustomEvent.value