UNPKG

route-claudecode

Version:

Advanced routing and transformation system for Claude Code outputs to multiple AI providers

81 lines 2.23 kB
/** * OpenAI Input Format Processor * Handles incoming requests in OpenAI API format * 项目所有者: Jason Zhang */ import { InputProcessor, BaseRequest } from '@/types'; export interface OpenAIRequest { model: string; messages: Array<{ role: 'user' | 'assistant' | 'system' | 'tool'; content: string | Array<any>; tool_calls?: Array<{ id: string; type: 'function'; function: { name: string; arguments: string; }; }>; tool_call_id?: string; }>; tools?: Array<{ type: 'function'; function: { name: string; description: string; parameters: Record<string, any>; }; }>; tool_choice?: 'auto' | 'none' | string | { type: 'function'; function: { name: string; }; }; max_tokens?: number; temperature?: number; stream?: boolean; metadata?: Record<string, any>; } /** * Architecture Note: Preprocessing has been moved to the routing layer. * Input layer now only handles basic format validation and parsing. * All transformations and patches are handled by the Enhanced Routing Engine. */ export declare class OpenAIInputProcessor implements InputProcessor { readonly name = "openai"; /** * Check if this processor can handle the request */ canProcess(request: any): boolean; /** * Process the incoming request */ process(request: any): Promise<BaseRequest>; /** * Convert OpenAI format to Anthropic-like format for internal processing */ private convertToAnthropicFormat; /** * Convert OpenAI message content to Anthropic format */ private convertMessageContent; /** * Validate the request format */ validate(request: any): boolean; /** * Check if tools are in OpenAI format */ private isOpenAIToolsFormat; /** * Normalize messages to internal format */ private normalizeMessages; /** * Normalize content to handle both string and array formats */ private normalizeContent; } //# sourceMappingURL=processor.d.ts.map