/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { AnthropicModelConfig } from "./Anthropic_ModelSchema"; /** * Highest Claude generation that still accepts `temperature` / `top_p`. * Newer generations reject them with HTTP 400, which maps to a * non-retryable `PermanentJobError`. */ export declare const ANTHROPIC_LAST_SAMPLING_MAJOR = 4; /** Highest minor within {@link ANTHROPIC_LAST_SAMPLING_MAJOR} that accepts them. */ export declare const ANTHROPIC_LAST_SAMPLING_MINOR = 6; interface ParsedAnthropicModelId { /** Empty for the bare `claude-2.1` shape, which carries no family name. */ readonly family: string; readonly major: number; readonly minor: number | undefined; } /** * Parses the three id shapes Anthropic has shipped: * - modern `claude--[-][-]` (`claude-opus-4-8`) * - legacy `claude-[-]-[-]` (`claude-3-5-sonnet-20241022`) * - bare `claude-[instant-][.]` (`claude-2.1`, `claude-instant-1.2`) * * Returns `undefined` for anything else, including non-Claude ids. */ export declare function parseAnthropicModelId(id: string): ParsedAnthropicModelId | undefined; /** * Whether the configured model accepts `temperature` / `top_p`. * * This is an allow-list of generations known to accept them, not a deny-list * of the ones that reject them: an id that does not match a known-accepting * shape is treated as rejecting. A wrong `false` changes sampling behavior; a * wrong `true` is an unrecoverable 400, so an unrecognized id defaults to * omitting. `provider_config.sampling_params` overrides the decision either way. */ export declare function anthropicAcceptsSamplingParams(model: AnthropicModelConfig | undefined): boolean; interface AnthropicSamplingInput { readonly temperature?: number; readonly topP?: number; } /** * Copies the caller's sampling fields onto an Anthropic request body when the * model accepts them. On a rejecting model the keys are left absent (rather * than set to `undefined`) and a single warning names everything dropped, so * the user's setting becoming a no-op is visible without failing the request. * * Call this after {@link applyAnthropicThinkingParams}: whether the request * carries extended thinking decides whether sampling is legal at all. */ export declare function applyAnthropicSamplingParams(params: Record, input: AnthropicSamplingInput, model: AnthropicModelConfig | undefined): void; export {};