UNPKG

mock-openai-api

Version:

A mock OpenAI Compatible Provider API server

42 lines 1.15 kB
import { MockModel, MockTestCase } from '../types'; /** * Generate unique chat completion ID */ export declare function generateChatCompletionId(): string; /** * Generate unique image ID */ export declare function generateImageId(): string; /** * Get current timestamp */ export declare function getCurrentTimestamp(): number; /** * Find model by ID */ export declare function findModelById(modelId: string): MockModel | undefined; /** * Select the most matching test case based on user input */ export declare function selectTestCase(model: MockModel, userPrompt: string): MockTestCase; /** * Calculate token count (simple estimation) */ export declare function calculateTokens(text: string): number; /** * Randomly select an item from array */ export declare function randomChoice<T>(array: T[]): T; /** * Format error response */ export declare function formatErrorResponse(message: string): any; /** * 验证模型是否支持流式输出 */ export declare function supportsStreaming(modelId: string): boolean; /** * 延迟函数 */ export declare function sleep(ms: number): Promise<void>; //# sourceMappingURL=helpers.d.ts.map