Skip to content

generateText

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

Defined in: node_modules/.bun/ai@7.0.127+bca6845d7a0cc15a/node_modules/ai/dist/index.d.ts:5220

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

RUNTIME_CONTEXT extends Context = Context

OUTPUT extends Output<any, any, any> = Output<string, string, any>

LanguageModelCallOptions & (RequestOptions<TOOLS> & Prompt) & object & ToolsContextSettings<TOOLS> & object

The language model to use.

Promise<GenerateTextResult<TOOLS, RUNTIME_CONTEXT, OUTPUT>>

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