Open History to see the last commit
1---
2id: StructuredOutputCompleteEvent
3title: StructuredOutputCompleteEvent
4---
5
6Defined in: packages/ai/src/types.ts:1777
7
8Final event of a streaming structured-output run. Carries the validated
9`object` (typed as `T` after the orchestrator runs Standard Schema parsing),
10the `raw` JSON text that produced it, and — for thinking/reasoning models —
11the accumulated reasoning text. Adapters emit this with `T = unknown`; the
12chat orchestrator narrows to the schema's inferred type after validation.
13
14`reasoning` is `undefined` when the model produced none (most non-thinking
15models) and when the underlying adapter doesn't expose reasoning streams.
16
17`name` is a string literal so consumers can narrow directly:
18
19```ts
20if (chunk.type === 'CUSTOM' && chunk.name === 'structured-output.complete') {
21 chunk.value.object // typed as T
22}
23```
24
25## Extends
26
27- [`CustomEvent`](CustomEvent.md)
28
29## Type Parameters
30
31### T
32
33`T` = `unknown`
34
35## Properties
36
37### metadata?
38
39```ts
40optional metadata?: Record<string, any>;
41```
42
43Defined in: packages/ai/src/types.ts:1756
44
45Extra information attached to this event.
46
47#### Inherited from
48
49[`CustomEvent`](CustomEvent.md).[`metadata`](CustomEvent.md#metadata)
50
51***
52
53### name
54
55```ts
56name: "structured-output.complete";
57```
58
59Defined in: packages/ai/src/types.ts:1780
60
61What this custom event is. Required: without it a consumer cannot route
62the value.
63
64#### Overrides
65
66```ts
67CustomEvent.name
68```
69
70***
71
72### type
73
74```ts
75type: "CUSTOM";
76```
77
78Defined in: packages/ai/src/types.ts:1755
79
80#### Inherited from
81
82[`CustomEvent`](CustomEvent.md).[`type`](CustomEvent.md#type)
83
84***
85
86### value
87
88```ts
89value: object;
90```
91
92Defined in: packages/ai/src/types.ts:1781
93
94The payload. Any JSON value, and required.
95
96#### object
97
98```ts
99object: T;
100```
101
102#### raw
103
104```ts
105raw: string;
106```
107
108#### reasoning?
109
110```ts
111optional reasoning?: string;
112```
113
114#### Overrides
115
116```ts
117CustomEvent.value
118```