Skip to content

generateText

generateText<TOOLS, OUTPUT, OUTPUT_PARTIAL>(model): Promise<GenerateTextResult<TOOLS, OUTPUT>>

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

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

This function does not stream the output. If you want to stream the output, use streamText instead.

TOOLS extends ToolSet

OUTPUT = never

OUTPUT_PARTIAL = never

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

The language model to use.

Promise<GenerateTextResult<TOOLS, OUTPUT>>

A result object that contains the generated text, the results of the tool calls, and additional information.