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.
import { Config } from "@adaline/types";

const config = Config().parse({
  temperature: 0.7,
  maxTokens: 500,
  topP: 0.9,
  frequencyPenalty: 0,
  presencePenalty: 0,
  stop: ["\n"],
});

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:
const embeddingConfig = Config().parse({
  encodingFormat: "float",
  dimensions: 256,
});
encodingFormat
string
The encoding format for embeddings. Common values: "float", "base64".
dimensions
number
The number of dimensions for the output embeddings.