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

ChunkStrategy.md

58 lines1.0 KB

Interface: ChunkStrategy

Defined in: activities/chat/stream/types.ts:33

Strategy for determining when to emit text updates

Properties

reset()?

optional reset: () => void;

Defined in: activities/chat/stream/types.ts:45

Optional: Reset strategy state (called when streaming starts)

Returns

void


shouldEmit()

shouldEmit: (chunk, accumulated) => boolean;

Defined in: activities/chat/stream/types.ts:40

Called for each text chunk received

Parameters

chunk

string

The new chunk of text (delta)

accumulated

string

All text accumulated so far

Returns

boolean

true if an update should be emitted now