Type alias StreamPart

StreamPart: {
    type: "text";
    text: string;
} | {
    type: "tool-call";
    toolName: string;
    args: unknown;
} | {
    type: "tool-result";
    toolName: string;
    result: unknown;
} | {
    type: "error";
    error: Error;
}

A discriminated union representing a single event emitted by the StreamTextResult.fullStream iterable.

  • "text" — incremental token delta from the model.
  • "tool-call" — the model requested a tool invocation.
  • "tool-result" — the tool has been executed and the result is available.
  • "error" — an unrecoverable error occurred; the stream ends after this part.

Type declaration

  • type: "text"
  • text: string

Type declaration

  • type: "tool-call"
  • toolName: string
  • args: unknown

Type declaration

  • type: "tool-result"
  • toolName: string
  • result: unknown

Type declaration

  • type: "error"
  • error: Error