Skip to content

streamText

streamText<TOOLS, OUTPUT, PARTIAL_OUTPUT>(model): StreamTextResult<TOOLS, PARTIAL_OUTPUT>

Defined in: node_modules/.bun/ai@5.0.188+27912429049419a2/node_modules/ai/dist/index.d.ts:1341

Generate a text and call tools for a given prompt using a language model.

This function streams the output. If you do not want to stream the output, use generateText instead.

TOOLS extends ToolSet

OUTPUT = never

PARTIAL_OUTPUT = never

CallSettings & Prompt & { model: LanguageModel; tools?: TOOLS | undefined; toolChoice?: ToolChoice<TOOLS> | undefined; stopWhen?: StopCondition<NoInfer<TOOLS>> | StopCondition<…>[] | undefined; … 16 more …; _internal?: { …; } | undefined; }

The language model to use.

StreamTextResult<TOOLS, PARTIAL_OUTPUT>

A result object for accessing different stream types and additional information.