/** * Author: Srilal S. Siriwardhane * Email: SrilalS@99x.io **/ import { MLCEngine } from "@mlc-ai/web-llm"; import { AbstractLLMInferenceEngine } from "./AbstractLLMInferenceEngine.js"; import { ChatMessage } from "../types/ChatMessages.js"; import { AvailableModels } from "../types/AvailableModels.js"; import { Model } from "../types/Model.js"; import { LLMStatus } from "../types/LLMStatus.js"; /** * WebLLMModel type to represent the available models. * This type is extended by the `Model` Enum to enforce the model type. */ type WebLLMModel = Model | 'phi' | 'gemma' | 'phi35' | 'gemma2'; /** * WebLLMInferenceEngine class to handle the LLM Inference using the Web-LLM. * This class extends the LLMInferenceFactory to enforce the methods. */ export declare class WebLLMInferenceEngine extends AbstractLLMInferenceEngine { private status; private statusEmitter; llmModel: WebLLMModel; engine: MLCEngine; /** * constructor * @param model - The model to be used for inference. should be one of allowed models. * Allowed Models: 'phi', 'gemma' * This list of models will be updated as more models are added in the future releases. */ constructor(model: WebLLMModel); static init(model: WebLLMModel): Promise; /** * createEngine * * This function is used to create the engine based on the selected model. * */ createEngine(): Promise; /** * availableModels * @returns AvailableModels */ availableModels: AvailableModels; runChatInference(chat: ChatMessage[]): Promise; runCompletionInference(prompt: string): Promise; /** * getModel * @returns string * * This function is used to get the model name based on the selected model. * It returns a string. * */ getModel(): string; progressCallback(progress: any): void; /** * onStatusChange * @param listener - The listener to be used for status change. * * This function is used to listen to the status change of the inference. * */ onStatusChange(listener: (status: LLMStatus) => void): void; } export {};