UNPKG

woolball-client

Version:

Client-side library for Woolball enabling secure browser resource sharing for distributed AI task processing

48 lines (47 loc) 1.25 kB
/** * WebLLM processor for handling LLM tasks * Based on the documentation: https://webllm.mlc.ai/docs/user/basic_usage.html */ interface WebLLMConfig { initProgressCallback?: (progress: any) => void; } interface ChatMessage { role: 'system' | 'user' | 'assistant'; content: string; } interface GenerationOptions { messages: ChatMessage[]; temperature?: number; max_new_tokens?: number; stream?: boolean; stream_options?: { include_usage?: boolean; }; } /** * Main WebLLM processor class that handles interactions with the MLC WebLLM library */ export declare class WebLLMProcessor { private engine; private model; private initProgress; private webllmModule; constructor(config?: WebLLMConfig); /** * Initializes the WebLLM engine with the specified model */ initialize(model: string): Promise<void>; /** * Generate text using WebLLM chat completion API */ generateText(options: GenerationOptions): Promise<any>; /** * Clean up resources when done */ cleanup(): Promise<void>; } /** * Get or create a WebLLM processor instance */ export declare function getWebLLMProcessor(config?: WebLLMConfig): WebLLMProcessor; export {};