@yamlresume/ai
    Preparing search index...

    Function generateText

    • 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.

      Type Parameters

      • TOOLS extends ToolSet
      • OUTPUT = never
      • OUTPUT_PARTIAL = never

      Parameters

      • model: CallSettings & Prompt & {
            _internal?: { currentDate?: () => Date; generateId?: IDGenerator };
            experimental_activeTools?: (keyof TOOLS)[];
            experimental_continueSteps?: boolean;
            experimental_generateMessageId?: IDGenerator;
            experimental_output?: Output<OUTPUT, OUTPUT_PARTIAL>;
            experimental_prepareStep?: (
                options: {
                    maxSteps: number;
                    model: LanguageModelV1;
                    stepNumber: number;
                    steps: StepResult<TOOLS>[];
                },
            ) => PromiseLike<
                {
                    experimental_activeTools?: (keyof TOOLS)[];
                    model?: LanguageModelV1;
                    toolChoice?: ToolChoice<TOOLS>;
                },
            >;
            experimental_providerMetadata?: ProviderMetadata;
            experimental_repairToolCall?: ToolCallRepairFunction<TOOLS>;
            experimental_telemetry?: TelemetrySettings;
            maxSteps?: number;
            model: LanguageModelV1;
            onStepFinish?: GenerateTextOnStepFinishCallback<TOOLS>;
            providerOptions?: ProviderOptions;
            toolChoice?: ToolChoice<TOOLS>;
            tools?: TOOLS;
        }

        The language model to use.

        • Optional_internal?: { currentDate?: () => Date; generateId?: IDGenerator }

          Internal. For test use only. May change without notice.

        • Optionalexperimental_activeTools?: (keyof TOOLS)[]

          Limits the tools that are available for the model to call without changing the tool call and result types in the result.

        • Optionalexperimental_continueSteps?: boolean

          When enabled, the model will perform additional steps if the finish reason is "length" (experimental).

          By default, it's set to false.

        • Optionalexperimental_generateMessageId?: IDGenerator

          Generate a unique ID for each message.

        • Optionalexperimental_output?: Output<OUTPUT, OUTPUT_PARTIAL>

          Optional specification for parsing structured outputs from the LLM response.

        • Optionalexperimental_prepareStep?: (
              options: {
                  maxSteps: number;
                  model: LanguageModelV1;
                  stepNumber: number;
                  steps: StepResult<TOOLS>[];
              },
          ) => PromiseLike<
              {
                  experimental_activeTools?: (keyof TOOLS)[];
                  model?: LanguageModelV1;
                  toolChoice?: ToolChoice<TOOLS>;
              },
          >

          Optional function that you can use to provide different settings for a step.

        • Optionalexperimental_providerMetadata?: ProviderMetadata

          Use providerOptions instead.

        • Optionalexperimental_repairToolCall?: ToolCallRepairFunction<TOOLS>

          A function that attempts to repair a tool call that failed to parse.

        • Optionalexperimental_telemetry?: TelemetrySettings

          Optional telemetry configuration (experimental).

        • OptionalmaxSteps?: number

          Maximum number of sequential LLM calls (steps), e.g. when you use tool calls. Must be at least 1.

          A maximum number is required to prevent infinite loops in the case of misconfigured tools.

          By default, it's set to 1, which means that only a single LLM call is made.

        • model: LanguageModelV1

          The language model to use.

        • OptionalonStepFinish?: GenerateTextOnStepFinishCallback<TOOLS>

          Callback that is called when each step (LLM call) is finished, including intermediate steps.

        • OptionalproviderOptions?: ProviderOptions

          Additional provider-specific options. They are passed through to the provider from the AI SDK and enable provider-specific functionality that can be fully encapsulated in the provider.

        • OptionaltoolChoice?: ToolChoice<TOOLS>

          The tool choice strategy. Default: 'auto'.

        • Optionaltools?: TOOLS

          The tools that the model can call. The model needs to support calling tools.

      Returns Promise<GenerateTextResult<TOOLS, OUTPUT>>

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