Skip to content

StreamContentChunk

Defined in: packages/ai.matey.types/src/ir.ts:876

Content chunk with flexible streaming support.

Supports both delta (incremental) and accumulated (full text) streaming modes:

Delta Mode (default):

  • delta contains only the new text generated in this chunk
  • Consumers must accumulate deltas to get full text
  • Most efficient for network and memory

Accumulated Mode (optional):

  • accumulated contains all text generated so far
  • Each chunk has the complete text up to that point
  • Useful for UIs that want to replace text (Chrome AI style)

Backward Compatibility:

  • delta is ALWAYS present (universal standard)
  • accumulated is optional (provided when backend configured for it)
// Delta-only chunk (standard)
{ type: 'content', delta: ' world', sequence: 2 }
// With both formats (configured backend)
{ type: 'content', delta: ' world', accumulated: 'Hello world', sequence: 2 }

readonly optional accumulated: string

Defined in: packages/ai.matey.types/src/ir.ts:891

Accumulated text (full content so far). Optional - provided when backend is configured for accumulated mode. Contains all text generated from the start up to and including this chunk.


readonly delta: string

Defined in: packages/ai.matey.types/src/ir.ts:884

Incremental text delta (new content only). ALWAYS present for maximum compatibility. Contains only the text generated in this chunk.


readonly optional role: "assistant"

Defined in: packages/ai.matey.types/src/ir.ts:893


readonly sequence: number

Defined in: packages/ai.matey.types/src/ir.ts:837

BaseStreamChunk.sequence


readonly type: "content"

Defined in: packages/ai.matey.types/src/ir.ts:877

BaseStreamChunk.type