Open History to see the last commit
1---
2id: StructuredOutputPart
3title: StructuredOutputPart
4---
5
6# Interface: StructuredOutputPart\<TData\>
7
8Defined in: [packages/ai/src/types.ts:436](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L436)
9
10StructuredOutputPart — a typed structured response attached to the assistant
11message that produced it. Generic over the schema-inferred data type so
12consumers can thread `useChat({ outputSchema })`'s schema all the way down
13to `messages[i].parts[j].data`. Defaults to `unknown` so untyped consumers
14(e.g. internal codepaths that don't know about TSchema) keep working.
15
16## Type Parameters
17
18### TData
19
20`TData` = `unknown`
21
22## Properties
23
24### data?
25
26```ts
27optional data: TData;
28```
29
30Defined in: [packages/ai/src/types.ts:442](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L442)
31
32Validated final object — only set when `status === 'complete'`.
33
34***
35
36### errorMessage?
37
38```ts
39optional errorMessage: string;
40```
41
42Defined in: [packages/ai/src/types.ts:448](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L448)
43
44Populated when `status === 'error'`.
45
46***
47
48### partial?
49
50```ts
51optional partial: DeepPartial<TData>;
52```
53
54Defined in: [packages/ai/src/types.ts:440](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L440)
55
56Progressive parse of `raw` via parsePartialJSON — populated while streaming and after complete.
57
58***
59
60### raw
61
62```ts
63raw: string;
64```
65
66Defined in: [packages/ai/src/types.ts:444](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L444)
67
68Accumulating JSON buffer. Source of truth for wire round-trip.
69
70***
71
72### reasoning?
73
74```ts
75optional reasoning: string;
76```
77
78Defined in: [packages/ai/src/types.ts:446](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L446)
79
80Optional chain-of-thought surfaced by reasoning models alongside the structured output.
81
82***
83
84### status
85
86```ts
87status: "error" | "complete" | "streaming";
88```
89
90Defined in: [packages/ai/src/types.ts:438](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L438)
91
92***
93
94### type
95
96```ts
97type: "structured-output";
98```
99
100Defined in: [packages/ai/src/types.ts:437](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L437)