export type ServiceOptions = { host?: string; region?: string; timeout?: number; }; interface IFunction { name: string; description: string; parameters?: Record; examples?: string[]; } export interface Tool { type: string; function: IFunction; } export interface FunctionCall { name: string; arguments: string; } export interface ToolCall { Function: FunctionCall; id: string; type: string; } export declare enum ChatRole { User = "user", Assistant = "assistant", System = "system", Function = "function" } export interface Reference { url: string; idx: number; logo_url: string; pc_url: string; site_name: string; } export interface Message { content: string; name?: string; references?: Reference[]; role: ChatRole; tool_call_id?: string; tool_calls?: ToolCall[]; } 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; logprobs?: number; } export interface ChatReq { crypto_token?: string; extra?: Record; messages: Message[]; parameters?: Parameters; stream?: boolean; tools?: Tool[]; user?: string; } interface ChoiceLog { content: string; input: string; } interface Logprobs { text_offset: number[]; token_logprobs: number[]; tokens: string[]; top_logprobs: Record[]; } export interface Choice { index?: number; message?: Message; finish_reason?: string; action?: ChoiceLog; logprobs?: Logprobs; observation?: ChoiceLog; thought?: ChoiceLog; } export interface Usage { prompt_tokens: number; completion_tokens: number; total_tokens: number; } export interface Error { code: string; code_n: number; message: string; } export interface ChatResp { req_id?: string; error?: Error; choices?: Choice[]; usage?: Usage; extra?: { [key: string]: string; }; } export interface TokenizeReq { text: string; } export interface TokenizeResp { req_id: string; error?: Error; tokens: string[]; total_tokens: number; } export interface ClassificationReq { labels: string[]; query: string; } export interface LabelLogprobosValue { req_id?: string; tokens: string[]; token_logprobos: string[]; } export interface ClassificationResp { req_id: string; error?: Error; label: string; label_logprobos: Record; usage?: Usage; } export interface EmbeddingsReq { input: string[]; } export interface Embedding { index?: number; embedding: number[]; object: string; } export interface EmbeddingsResp { req_id?: string; object?: string; data: Embedding[]; usage?: Usage; error?: Error; } export {};