export type ServiceOptions = { host?: string; region?: string; timeout?: number; }; export interface Model { name?: string; endpoint_id?: string; version?: string; } export declare enum ChatRole { User = "user", Assistant = "assistant", System = "system", Function = "function" } export interface FunctionCall { name: string; arguments: string; } export interface Reference { url: string; idx: number; logo_url: string; pc_url: string; site_name: string; } export interface Message { role: ChatRole; content: string; name?: string; function_call?: FunctionCall; references?: Reference[]; } export interface Error { code: string; code_n: number; message: string; } export interface Parameters { temperature?: number; max_tokens?: number; top_p?: number; presence_penalty?: number; frequency_penalty?: number; max_new_tokens?: number; repetition_penalty?: number; do_sample?: boolean; top_k?: number; min_new_tokens?: number; max_prompt_tokens?: number; } export interface Choice { index?: number; message: Message; finish_reason: string; logprobs?: number; } export interface Usage { prompt_tokens: number; completion_tokens: number; total_tokens: number; } export interface FunctionType { name: string; description: string; parameters: any; examples: string[]; } export interface ChatReq { model: Model; messages: Message[]; parameters?: Parameters; stream?: boolean; req_id?: string; crypto_token?: string; functions?: FunctionType[]; plugins?: string[]; extra?: { [key: string]: string; }; } export interface ChatResp { req_id: string; error?: Error; choice?: Choice; usage?: Usage; extra?: { [key: string]: string; }; } export interface TokenizeReq { model: Model; text: string; req_id?: string; } export interface TokenizeResp { req_id?: string; tokens: string[]; total_tokens?: number; error?: Error; } export interface ClassificationReq { req_id?: string; model: Model; query: string; labels: string[]; } export interface LabelLogprobosValue { req_id?: string; tokens: string[]; token_logprobos: string[]; } export interface ClassificationResp { req_id: string; label: string; label_logprobos: { [key: string]: LabelLogprobosValue; }; usage: Usage; error: Error; } export interface EmbeddingsReq { req_id?: string; model: Model; input: string[]; encoding_format?: string; user?: string; } export interface Embedding { index?: number; embedding: number[]; object: string; } export interface EmbeddingsResp { req_id?: string; object?: string; data: Embedding[]; usage?: Usage; error?: Error; }