route-claudecode
Version:
Advanced routing and transformation system for Claude Code outputs to multiple AI providers
52 lines • 1.94 kB
TypeScript
/**
* 统一响应转换器
* 项目所有者: Jason Zhang
*
* 遵循核心原则: 模型发送什么我们就返回什么
* - 不使用fallback机制
* - 不设置默认值
* - 保持响应的原始性
*/
import { AnthropicResponse, BaseRequest } from '@/types';
/**
* OpenAI消息内容转换为Anthropic内容格式
*/
export declare function convertOpenAIMessageToAnthropicContent(message: any): any[];
/**
* 标准化内容块为Anthropic格式
*/
export declare function normalizeToAnthropicContent(content: any): any[];
/**
* 严格的finish reason映射 - 不使用fallback
* @param finishReason 原始finish reason
* @returns 映射后的stop reason,如果无法映射则抛出错误
*/
export declare function mapFinishReasonStrict(finishReason?: string): string;
/**
* 严格的stop reason映射 - 不使用fallback
* @param stopReason 原始stop reason
* @returns 映射后的finish reason,如果无法映射则抛出错误
*/
export declare function mapStopReasonStrict(stopReason?: string): string;
/**
* 将OpenAI格式响应转换为Anthropic格式
* 严格遵循"模型发送什么就返回什么"原则
*/
export declare function convertOpenAIResponseToAnthropic(response: any, originalRequest: BaseRequest, requestId: string): AnthropicResponse;
/**
* 验证并标准化已有的Anthropic格式响应
*/
export declare function validateAndNormalizeAnthropicResponse(response: any, originalRequest: BaseRequest, requestId: string): AnthropicResponse;
/**
* 从各种格式转换为Anthropic响应
*/
export declare function convertToAnthropicResponse(response: any, originalRequest: BaseRequest, requestId: string): AnthropicResponse;
/**
* 获取支持的finish reasons
*/
export declare function getSupportedFinishReasons(): string[];
/**
* 获取支持的stop reasons
*/
export declare function getSupportedStopReasons(): string[];
//# sourceMappingURL=response-converter.d.ts.map