/** * Parse an SSE ReadableStream from the /responses endpoint and re-emit it as * an SSE ReadableStream whose chunks are in Chat Completions format. * * The output format is identical to what /chat/completions?stream=true * produces: lines of `data: {...}\n\n` terminated by `data: [DONE]\n\n`. */ interface ChatCompletion { id: string; object: 'chat.completion'; created: number; model: string; choices: Array<{ index: number; message: { role: string; content: string | null; refusal: null; }; finish_reason: string; }>; usage: { prompt_tokens: number; completion_tokens: number; total_tokens: number; cacheRead: number; cacheWrite: number; }; } /** * Convert a /responses API response object into a /chat/completions response * object so callers can handle both with identical code. */ export declare function convertResponseToChatCompletion(response: any): ChatCompletion; export declare function convertResponsesStreamToChatStream(responseStream: ReadableStream, model: string): ReadableStream; export declare function sleep(ms: number): Promise; export declare function formatFileSize(bytes: number, decimalPoint?: number): string; export declare function truncateString(str: string, num: number): string; export declare function unEscapeHTML(text: string): string; /** * Removes the $schema property from a JSON schema object. * This is useful when the schema needs to be stored in MongoDB or other systems * that don't support this metadata field. * * @param schema - The JSON schema object that may contain $schema property * @returns A new schema object without the $schema property */ export declare function removeSchemaMetadata(schema: any): any; export {};