UNPKG

ai

Version:

AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.

79 lines (69 loc) 2.44 kB
import type { LanguageModelV4CallOptions } from '@ai-sdk/provider'; /** * Model-facing generation controls. These settings influence how the model * generates its response (token limits, sampling, penalties, stop sequences, * seed, reasoning). */ export type LanguageModelCallOptions = { /** * Maximum number of tokens to generate. */ maxOutputTokens?: number; /** * Temperature setting. The range depends on the provider and model. * * It is recommended to set either `temperature` or `topP`, but not both. */ temperature?: number; /** * Nucleus sampling. This is a number between 0 and 1. * * E.g. 0.1 would mean that only tokens with the top 10% probability mass * are considered. * * It is recommended to set either `temperature` or `topP`, but not both. */ topP?: number; /** * Only sample from the top K options for each subsequent token. * * Used to remove "long tail" low probability responses. * Recommended for advanced use cases only. You usually only need to use temperature. */ topK?: number; /** * Presence penalty setting. It affects the likelihood of the model to * repeat information that is already in the prompt. * * The presence penalty is a number between -1 (increase repetition) * and 1 (maximum penalty, decrease repetition). 0 means no penalty. */ presencePenalty?: number; /** * Frequency penalty setting. It affects the likelihood of the model * to repeatedly use the same words or phrases. * * The frequency penalty is a number between -1 (increase repetition) * and 1 (maximum penalty, decrease repetition). 0 means no penalty. */ frequencyPenalty?: number; /** * Stop sequences. * If set, the model will stop generating text when one of the stop sequences is generated. * Providers may have limits on the number of stop sequences. */ stopSequences?: string[]; /** * The seed (integer) to use for random sampling. If set and supported * by the model, calls will generate deterministic results. */ seed?: number; /** * Reasoning effort level for the model. Controls how much reasoning * the model performs before generating a response. * * Use `'provider-default'` to use the provider's default reasoning level. * Use `'none'` to disable reasoning (if supported by the provider). */ reasoning?: LanguageModelV4CallOptions['reasoning']; };