Skip to main content

Config

Configuration types for controlling model behavior.

Config

The Config function creates a Zod schema for parsing model configuration. All fields are optional and provider-specific.

Common Fields

temperature
number
Controls randomness. 0 is deterministic, higher values are more creative. Range: 0 to 2.
maxTokens
number
Maximum number of tokens to generate.
topP
number
Nucleus sampling threshold. Range: 0 to 1.
frequencyPenalty
number
Penalize tokens based on frequency. Range: -2 to 2.
presencePenalty
number
Penalize tokens based on presence. Range: -2 to 2.
stop
string[]
Stop sequences that halt generation.
seed
number
Random seed for deterministic outputs (provider support varies).

Embedding Config

For embedding models, the config supports:
encodingFormat
string
The encoding format for embeddings. Common values: "float", "base64".
dimensions
number
The number of dimensions for the output embeddings.