UNPKG

rcc-pipeline

Version:

RCC Pipeline Module - Pipeline system and workflow management based on pipeline-framework

184 lines 4.96 kB
/** * OpenAI Standard Interface Definitions (TypeScript version) * 标准OpenAI接口定义 */ export type MessageRole = 'system' | 'user' | 'assistant' | 'tool'; export type ToolType = 'function'; export type FinishReason = 'stop' | 'length' | 'tool_calls' | 'content_filter'; export interface ChatMessageData { role: MessageRole; content: string | Array<{ type: string; text?: string; image_url?: { url: string; }; }>; name?: string | null; function_call?: FunctionCallData | null; tool_calls?: ToolCallData[] | null; tool_call_id?: string | null; } export interface FunctionCallData { name: string; arguments: string; } export interface ToolCallData { id: string; type: ToolType; function: FunctionCallData; } export interface ChatToolData { type: ToolType; function: { name: string; description?: string; parameters: Record<string, any>; }; } export interface ChatChoiceData { index: number; message: ChatMessageData; finish_reason: FinishReason; logprobs?: any | null; } export interface UsageStatsData { prompt_tokens: number; completion_tokens: number; total_tokens: number; } export interface OpenAIChatRequestData { model: string; messages: ChatMessageData[]; temperature?: number; max_tokens?: number; top_p?: number; n?: number; stream?: boolean; stop?: string | string[] | null; presence_penalty?: number; frequency_penalty?: number; logit_bias?: Record<string, number> | null; user?: string; tools?: ChatToolData[]; tool_choice?: string | Record<string, any> | null; } export interface OpenAIChatResponseData { id: string; object: string; created: number; model: string; choices: ChatChoiceData[]; usage?: UsageStatsData; system_fingerprint?: string; } export declare class OpenAIChatRequest { model: string; messages: ChatMessageData[]; temperature?: number; max_tokens?: number; top_p?: number; n?: number; stream: boolean; stop?: string | string[] | null; presence_penalty?: number; frequency_penalty?: number; logit_bias?: Record<string, number> | null; user?: string; tools?: ChatToolData[]; tool_choice?: string | Record<string, any> | null; constructor(data: OpenAIChatRequestData); validate(): boolean; } export declare class OpenAIChatResponse { id: string; object: string; created: number; model: string; choices: ChatChoiceData[]; usage?: UsageStatsData; system_fingerprint?: string; constructor(data: OpenAIChatResponseData); toStandardFormat(): OpenAIChatResponseData; } export declare class ChatMessage { role: MessageRole; content: string | Array<{ type: string; text?: string; image_url?: { url: string; }; }>; name: string | null; function_call: FunctionCallData | null; tool_calls: ToolCallData[] | null; tool_call_id: string | null; constructor(role: MessageRole, content: string | Array<{ type: string; text?: string; image_url?: { url: string; }; }>); static user(content: string | Array<{ type: string; text?: string; image_url?: { url: string; }; }>): ChatMessage; static assistant(content: string | Array<{ type: string; text?: string; image_url?: { url: string; }; }>, toolCalls?: ToolCallData[]): ChatMessage; static system(content: string | Array<{ type: string; text?: string; image_url?: { url: string; }; }>): ChatMessage; static tool(toolId: string, content: string): ChatMessage; } export declare class ChatChoice { index: number; message: ChatMessageData; finish_reason: FinishReason; logprobs: any | null; constructor(index: number, message: ChatMessageData, finishReason?: FinishReason); } export declare class ToolCall { id: string; type: ToolType; function: FunctionCallData; constructor(id: string, type: ToolType, function_: FunctionCallData); } export declare class FunctionCall { name: string; arguments: string; constructor(name: string, arguments_: string); } export declare class ChatTool { type: ToolType; function: { name: string; description?: string; parameters: Record<string, any>; }; constructor(type: ToolType, function_: { name: string; description?: string; parameters: Record<string, any>; }); } export declare class UsageStats { prompt_tokens: number; completion_tokens: number; total_tokens: number; constructor(promptTokens?: number, completionTokens?: number, totalTokens?: number); } //# sourceMappingURL=OpenAIInterface.d.ts.map