import type { Message, TextBlock, Tool } from '@wrongstack/core/types'; export interface OpenAIToolSchema { type: 'function'; function: { name: string; description: string; parameters: Record; }; } export declare function toolsToOpenAI(tools: Tool[]): OpenAIToolSchema[]; export interface OpenAIMessage { role: 'system' | 'user' | 'assistant' | 'tool'; content?: string | OpenAIContent[] | null | undefined; tool_calls?: OpenAIToolCall[] | undefined; tool_call_id?: string | undefined; name?: string | undefined; /** * DeepSeek (and other OpenAI-compatible thinking-mode models) require the * previous assistant's chain-of-thought to be echoed back on the next * request as a top-level `reasoning_content` field on the assistant * message — NOT inside individual tool_calls. Without it DeepSeek * returns 400 "reasoning_content in the thinking mode must be passed * back to the API". Vanilla OpenAI ignores this field, so emitting it * unconditionally is safe. */ reasoning_content?: string | undefined; } export interface OpenAIContent { type: 'text' | 'image_url'; text?: string | undefined; image_url?: { url: string | undefined; }; } export interface OpenAIToolCall { id: string; type: 'function'; function: { name: string; arguments: string; }; } export interface ConvertOptions { flattenContentToString?: boolean | undefined; stripCacheControl?: boolean | undefined; systemAsMessage?: boolean | undefined; /** * What to write as the assistant message's `content` field when the * message has tool_calls but no prose. Two values: * * - `'empty_string'` (default): writes `content: ''`. This is the * OpenAI 2024-2025 wire-format contract. Vanilla OpenAI, K2P7, * strict Mistral / OpenRouter / DeepSeek proxies all reject * requests where `content` is missing or `null` on a tool_call * assistant message. * * - `'null'`: writes `content: null` explicitly. Some older or * permissive proxies (e.g. certain vLLM builds, local llama.cpp * servers) prefer this. Set this only if a specific provider * rejects the empty-string form. * * The default is `'empty_string'` (NOT undefined) because omitting * `content` entirely (the pre-2024 behaviour) breaks too many * providers to be the safe default in 2025. Callers that need the * old behaviour can opt in with `emptyToolCallContent: 'null'`. */ emptyToolCallContent?: 'null' | 'empty_string' | undefined; } export declare function messagesToOpenAI(system: TextBlock[] | undefined, messages: Message[], opts?: ConvertOptions): OpenAIMessage[]; //# sourceMappingURL=to-openai.d.ts.map