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

orderedAssistantBlocks.md

30 lines867 Bytes

1---
2id: orderedAssistantBlocks
3title: orderedAssistantBlocks
4---
5​
6```ts
7function orderedAssistantBlocks(message):
8 | OrderedAssistantBlock[]
9 | undefined;
10```
11​
12Defined in: [packages/ai/src/utilities/block-order.ts:58](https://github.com/TanStack/ai/blob/main/packages/ai/src/utilities/block-order.ts#L58)
13​
14The blocks of an assistant message in map order, or undefined when the
15message has no map or the map does not match the message. A map matches
16when it uses each `thinking` entry and each `toolCalls` entry exactly once,
17and its text lengths add up to the length of the text content (`null`
18content counts as no text). Readers use the default order when this
19returns undefined.
20​
21## Parameters
22​
23### message
24​
25[`ModelMessage`](../interfaces/ModelMessage.md)
26​
27## Returns
28​
29 \| [`OrderedAssistantBlock`](../type-aliases/OrderedAssistantBlock.md)[]
30 \| `undefined`