TanStack

StructuredOutputCompleteEvent

Interface: StructuredOutputCompleteEvent<T>

Defined in: packages/ai/src/types.ts:1443

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:

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

Extends

Type Parameters

T

T = unknown

Properties

model?

ts
optional model?: string;

Defined in: packages/ai/src/types.ts:1414

Model identifier for multi-model support

Inherited from

CustomEvent.model


name

ts
name: "structured-output.complete";

Defined in: packages/ai/src/types.ts:1446

Overrides

ts
CustomEvent.name

runId?

ts
optional runId?: string;

Defined in: packages/ai/src/types.ts:1422

Inherited from

CustomEvent.runId


threadId?

ts
optional threadId?: string;

Defined in: packages/ai/src/types.ts:1421

Routing metadata the TanStack engine attaches when emitting CUSTOM events that need to be correlated with a specific thread/run. Stripped by strip-to-spec-middleware before going on the wire so the AG-UI consumer never sees them (when that middleware is enabled).

Inherited from

CustomEvent.threadId


type

ts
type: "CUSTOM";

Defined in: packages/ai/src/types.ts:1412

Inherited from

CustomEvent.type


value

ts
value: object;

Defined in: packages/ai/src/types.ts:1447

object

ts
object: T;

raw

ts
raw: string;

reasoning?

ts
optional reasoning?: string;

Overrides

ts
CustomEvent.value