UNPKG

doomiaichat

Version:

Doomisoft OpenAI

122 lines (121 loc) 2.65 kB
import { EmbeddingItem } from '@azure/openai'; export interface ApiResult { /** * return the result of api called * @type {boolean} */ 'successed': boolean; /** * The error info * @type {any} * @memberof ChatReponse */ 'error'?: any; } /** * Api封装后的返回结果 */ export interface ChatReponse extends ApiResult { /** * The name of the user in a multi-user chat * @type {Array<any>} * @memberof ChatReponse */ 'message'?: Array<any>; 'usage'?: any; } /** * 调用OpenAI Api的参数约定 */ export interface OpenAIApiParameters { 'embedding'?: string; 'model'?: string; 'maxtoken'?: number; 'temperature'?: number; 'top_p'?: number; 'presence_penalty'?: number; 'frequency_penalty'?: number; 'replyCounts'?: number; 'tools'?: Array<any>; 'tool_choice'?: string; 'enableToolCall'?: number; } /** * Azure 上的OpenAI的链接参数 */ export interface ProxyPatameters { 'serviceurl': string; } /** * OpenAI Proxy 链接参数 */ export interface AzureOpenAIPatameters { 'endpoint': string; 'engine': string; 'embedding'?: string; 'version'?: string; } /** * 调用OpenAI Api的向量约定 */ export interface EmbeddingResult extends ApiResult { 'embedding'?: EmbeddingItem[]; } /** * 远程请求的返回 */ export interface RpcResult extends ApiResult { 'data'?: any; } /** * Axios远程请求封装 * @param opts * @returns */ export declare function request(opts?: any): Promise<RpcResult>; /** * * @param opts * @returns */ export declare function requestStream(opts: any, processChunkData: Function): void; /** * 数据缓存提供者接口 */ export interface CacheProvider { /** * 缓存数据 * @param key 数据的键名称 * @param value 数据的键值 */ set(key: string, value: string | object, exp?: number): void; /** * 从缓存中读取数据 * @param key 数据的键名称 */ get(key: string): Promise<string | null>; /** * 删除缓存信息 * @param key 数据的键名称 */ delete(key: string): void; } export interface StabilityOption { 'cfg_scale'?: number; 'clip_guidance_preset'?: string; 'height'?: number; 'width'?: number; 'samples'?: number; 'seed'?: number; 'steps'?: number; 'sampler'?: string; 'negative'?: string; 'engine'?: string; 'endpoint'?: string; 'denoising_strength'?: number; 'hr_scale'?: number; } export interface StabilityResult extends ApiResult { 'data'?: any; 'type'?: string; }