/** * Utility functions for mapping unified ToolChoice to provider-specific formats. */ import type { ToolChoice } from "../types"; /** OpenAI Completions API tool choice format */ export type OpenAICompletionsToolChoice = "auto" | "none" | "required" | { type: "function"; function: { name: string; }; } | undefined; /** OpenAI Responses API tool choice format (flat structure) */ export type OpenAIResponsesToolChoice = "auto" | "none" | "required" | { type: "function"; name: string; } | { type: "custom"; name: string; } | undefined; /** Anthropic-compatible tool choice format */ export type AnthropicToolChoice = "auto" | "none" | "any" | { type: "tool"; name: string; } | undefined; /** * Map unified ToolChoice to OpenAI Completions API format. * - "any" → "required" * - { type: "tool", name } → { type: "function", function: { name } } */ export declare function mapToOpenAICompletionsToolChoice(choice?: ToolChoice): OpenAICompletionsToolChoice; /** * Returns true when an OpenAI-completions `tool_choice` value forces a tool * call (`"required"` or a function-name pin), as opposed to leaving it open * (`"auto"`, `"none"`, or unset). Accepts `unknown` because the param shape * pulled from the OpenAI SDK (`ChatCompletionToolChoiceOption`) widens with * each release; this check only needs the open/forced bit. */ export declare function isForcedToolChoice(choice: unknown): boolean; /** * Map unified ToolChoice to OpenAI Responses API format. * - "any" → "required" * - { type: "tool", name } → { type: "function", name } (flat structure) */ export declare function mapToOpenAIResponsesToolChoice(choice?: ToolChoice): OpenAIResponsesToolChoice; /** * Map unified ToolChoice to Anthropic-compatible format. * - "required" → "any" * - { type: "function", ... } → { type: "tool", name } */ export declare function mapToAnthropicToolChoice(choice?: ToolChoice): AnthropicToolChoice;