Skip to main content

Interface: AIStreamResult

Defined in: packages/workflow-engine/src/ai/types.ts:332

Properties​

rawResult​

rawResult: StreamTextResult<ToolSet, Context, Output<any, any, any>> | undefined

Defined in: packages/workflow-engine/src/ai/types.ts:360

Undefined when the stream was supplied by an AIAdapter.


stream​

stream: AsyncIterable<string>

Defined in: packages/workflow-engine/src/ai/types.ts:333

Methods​

getReasoning()​

getReasoning(): Promise<string | undefined>

Defined in: packages/workflow-engine/src/ai/types.ts:357

The model's reasoning/thinking text, when available. Reasoning is a separate channel from the answer; a model can reason without emitting any answer text (in which case getText() is empty but this is not). Resolves to undefined when the model produced no reasoning.

Returns​

Promise<string | undefined>


getText()​

getText(): Promise<string>

Defined in: packages/workflow-engine/src/ai/types.ts:350

The full answer text, after the stream completes. Consumes the stream if not already consumed. When the model streamed nothing on the text channel (e.g. a reasoning model), this reconciles against the buffered final text, so a text answer is never lost. May be "" for a reasoning-only response — in that case the content is in getReasoning.

Returns​

Promise<string>


getUsage()​

getUsage(): Promise<{ cost: number; costSource?: "reported" | "estimated"; inputTokens: number; outputTokens: number; reportedCostUsd?: number; }>

Defined in: packages/workflow-engine/src/ai/types.ts:334

Returns​

Promise<{ cost: number; costSource?: "reported" | "estimated"; inputTokens: number; outputTokens: number; reportedCostUsd?: number; }>