import type { ToolDefinition, ToolCall } from '../types/tools.js'; import type { ProviderMessage } from './interface.js'; export interface ToolArgumentParseContext { readonly provider?: string | undefined; readonly toolName?: string | undefined; readonly callId?: string | undefined; } export interface OpenAITool { type: 'function'; function: { name: string; description: string; parameters: Record; }; } export interface OpenAIToolCall { id: string; type: 'function'; function: { name: string; arguments: string; }; } export type OpenAIContentPart = { type: 'text'; text: string; } | { type: 'image_url'; image_url: { url: string; }; }; export interface OpenAIMessage { role: 'system' | 'user' | 'assistant' | 'tool'; content: string | OpenAIContentPart[] | null; tool_calls?: OpenAIToolCall[] | undefined; tool_call_id?: string | undefined; } /** Convert internal ToolDefinitions to OpenAI tools array. */ export declare function toOpenAITools(tools: ToolDefinition[]): OpenAITool[]; /** Parse OpenAI tool_calls from a response into internal ToolCall[]. */ export declare function fromOpenAIToolCalls(calls: OpenAIToolCall[]): ToolCall[]; /** Convert internal ProviderMessages to OpenAI message array. */ export declare function toOpenAIMessages(messages: ProviderMessage[], systemPrompt?: string): OpenAIMessage[]; export interface AnthropicTool { name: string; description: string; input_schema: Record; } export type AnthropicContentBlock = { type: 'text'; text: string; } | { type: 'image'; source: { type: 'base64'; media_type: 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp'; data: string; }; } | { type: 'tool_use'; id: string; name: string; input: Record; } | { type: 'tool_result'; tool_use_id: string; content: string; }; export interface AnthropicMessage { role: 'user' | 'assistant'; content: string | AnthropicContentBlock[]; } /** Convert internal ToolDefinitions to Anthropic tools array. */ export declare function toAnthropicTools(tools: ToolDefinition[]): AnthropicTool[]; /** Parse Anthropic response content blocks into text + ToolCall[]. */ export declare function fromAnthropicContent(content: AnthropicContentBlock[]): { text: string; toolCalls: ToolCall[]; }; /** Convert internal ProviderMessages to Anthropic message array. */ export declare function toAnthropicMessages(messages: ProviderMessage[]): AnthropicMessage[]; export interface GeminiFunctionDeclaration { name: string; description: string; parameters: Record; } export interface GeminiPart { text?: string | undefined; inlineData?: { mimeType: string; data: string; }; functionCall?: { name: string; args: Record; }; functionResponse?: { name: string; response: { content: string; }; }; } export interface GeminiContent { role: 'user' | 'model'; parts: GeminiPart[]; } /** Convert internal ToolDefinitions to Gemini functionDeclarations. */ export declare function toGeminiFunctionDeclarations(tools: ToolDefinition[]): GeminiFunctionDeclaration[]; /** Parse Gemini response parts into text + ToolCall[]. */ export declare function fromGeminiParts(parts: GeminiPart[]): { text: string; toolCalls: ToolCall[]; }; /** Convert internal ProviderMessages to Gemini contents array. */ export declare function toGeminiContents(messages: ProviderMessage[], systemPrompt?: string): { contents: GeminiContent[]; systemInstruction?: { parts: GeminiPart[]; } | undefined; }; /** * Extracts tool calls from raw text content for models (e.g. kimi-k2-thinking * via ollama-cloud) that emit tool calls as text tokens instead of using the * OpenAI function-calling wire format. * * Supports two delimiter formats (both emitted by kimi variants): * Without underscores: <|toolcallbegin|>functions.TOOLNAME:INDEX<|toolcallargumentbegin|>JSON_ARGS<|toolcallend|> * With underscores: <|tool_call_begin|>functions.TOOLNAME:INDEX<|tool_call_argument_begin|>JSON_ARGS<|tool_call_end|> * * A trailing <|tool_calls_section_end|> or <|toolcallssectionend|> is also * stripped from the cleaned content. * * @returns Extracted ToolCall array and the content with all tool-call tokens * removed (trimmed). Returns empty array when no text-based calls are found. */ export declare function extractTextToolCalls(content: string): { toolCalls: ToolCall[]; cleanedContent: string; }; /** * Strip the `anthropic:` or `anthropic/` prefix from an Anthropic model identifier. * Single canonical location, imported by anthropic.ts and anthropic-sdk-provider.ts. */ export declare function normalizeAnthropicModel(model: string): string; export declare function parseToolCallArguments(raw: string, context?: ToolArgumentParseContext): Record | undefined; //# sourceMappingURL=tool-formats.d.ts.map