@cristianglezm/vue-chatbot-widget
Version:
[](https://github.com/cristianglezm/vue-chatbot-widget/actions/workflows/cd.yml) [ • 26.8 kB
TypeScript
import ChatBotWorker from '@cristianglezm/vue-chatbot-widget/workers/chatbot.worker?worker';
import { ComponentOptionsMixin } from 'vue';
import { ComponentProvideOptions } from 'vue';
import { createPinia } from 'pinia';
import { DefineComponent } from 'vue';
import KokoroWorker from '@cristianglezm/vue-chatbot-widget/workers/kokoro.worker?worker';
import { PiniaCustomStateProperties } from 'pinia';
import { PublicProps } from 'vue';
import { StoreDefinition } from 'pinia';
declare const __VLS_component: DefineComponent< {}, {
$emit: (event: "on-change", ...args: any[]) => void;
mode: boolean;
left: string;
right: string;
$props: {
readonly mode?: boolean | undefined;
readonly left?: string | undefined;
readonly right?: string | undefined;
};
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
declare type __VLS_Slots = {
left?: ((props: {}) => any) | undefined;
right?: ((props: {}) => any) | undefined;
};
declare type __VLS_WithSlots<T, S> = T & (new () => {
$slots: S;
});
export declare const AudioPlayer: DefineComponent< {}, {
$emit: (event: "onRequestAudio", ...args: any[]) => void;
audioKey: string;
audioPlayer: HTMLAudioElement;
isAudioPlaying: boolean;
mode: string;
renderMode: string;
renderSampleRange: number;
maxWidth: number;
height: number;
$props: {
readonly audioKey?: string | undefined;
readonly audioPlayer?: HTMLAudioElement | undefined;
readonly isAudioPlaying?: boolean | undefined;
readonly mode?: string | undefined;
readonly renderMode?: string | undefined;
readonly renderSampleRange?: number | undefined;
readonly maxWidth?: number | undefined;
readonly height?: number | undefined;
};
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export declare const CacheManager: DefineComponent< {}, {
$emit: (event: "on-delete-host" | "on-delete-files", ...args: any[]) => void;
cacheName: string;
$props: {
readonly cacheName?: string | undefined;
};
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export declare const chat_template = "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are an expert in composing functions. Based on the given question and tools, make functions/tools call to achieve the purpose, if applicable. If no suitable tool exists or the question lacks required parameters, state this clearly.\n<tools>' }}{{ tools|tojson }}{{ '</tools>\n<docs_titles>' }}{% for doc in documents %}{{ doc }}{% if not loop.last %}, {% endif %}{% endfor %}{{ '</docs_titles>\nresponse format:\n<tool_call>[{\"name\": \"fn_name\", \"parameters\": {\"param\": \"value\"}}, ...]</tool_call>\n<|im_end|>\n' }}{% endif %}{{ '<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>\n' }}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}";
export declare const ChatBotModelOptions: DefineComponent< {}, {
emitter: Record<string, any>;
$props: {
readonly emitter?: Record<string, any> | undefined;
};
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
declare const ChatBotPlugin: {
install(app: any, options: ChatBotPluginOptions): void;
};
export default ChatBotPlugin;
declare interface ChatBotPluginOptions {
pinia: ReturnType<typeof createPinia>;
}
export declare const ChatBotWidget: DefineComponent< {}, {
executor: Function;
tools: unknown[];
documents: unknown[];
emitter: Record<string, any>;
system: string;
greetings: string;
chatTemplate: string;
editable: boolean;
config: Record<string, any>;
$props: {
readonly executor?: Function | undefined;
readonly tools?: unknown[] | undefined;
readonly documents?: unknown[] | undefined;
readonly emitter?: Record<string, any> | undefined;
readonly system?: string | undefined;
readonly greetings?: string | undefined;
readonly chatTemplate?: string | undefined;
readonly editable?: boolean | undefined;
readonly config?: Record<string, any> | undefined;
};
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export { ChatBotWorker }
export declare const ConfirmModal: DefineComponent< {}, {
id: string;
channel: Record<string, any>;
on: string;
$props: {
readonly id?: string | undefined;
readonly channel?: Record<string, any> | undefined;
readonly on?: string | undefined;
};
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export declare const ErrorModal: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export declare const initStores: (options: ChatBotPluginOptions) => void;
export declare const KokoroModelOptions: DefineComponent< {}, {
emitter: Record<string, any>;
$props: {
readonly emitter?: Record<string, any> | undefined;
};
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export { KokoroWorker }
export declare const LLMRemoteOptions: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export declare const MultiProgressModal: DefineComponent< {}, {
id: string;
channel: Record<string, any>;
on: string;
$props: {
readonly id?: string | undefined;
readonly channel?: Record<string, any> | undefined;
readonly on?: string | undefined;
};
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export declare const SwitchPanel: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
export declare const ToolTip: DefineComponent< {}, {
info: string;
$props: {
readonly info?: string | undefined;
};
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export declare const TTSRemoteOptions: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export declare const useChatBotStore: StoreDefinition<"ChatBotStore", {
wm: WorkerManager;
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
chatHistory: never[];
executor: (content: any) => {
textForUser: any[];
commandsToConfirm: never[];
};
}, {
getChatHistory: (state: {
wm: {
workers: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
channel: any;
addWorker: (name: string, worker: Worker) => void;
has: (name: string) => boolean;
deleteWorker: (name: string) => void;
sendRequest: (name: string, data: Object) => void;
onError: (name: string, callback: Function) => void;
onResponse: (name: string, callback: Function) => void;
};
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
chatHistory: never[];
executor: (content: any) => {
textForUser: any[];
commandsToConfirm: never[];
};
} & PiniaCustomStateProperties< {
wm: WorkerManager;
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
chatHistory: never[];
executor: (content: any) => {
textForUser: any[];
commandsToConfirm: never[];
};
}>) => never[];
getLastMessage: (state: {
wm: {
workers: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
channel: any;
addWorker: (name: string, worker: Worker) => void;
has: (name: string) => boolean;
deleteWorker: (name: string) => void;
sendRequest: (name: string, data: Object) => void;
onError: (name: string, callback: Function) => void;
onResponse: (name: string, callback: Function) => void;
};
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
chatHistory: never[];
executor: (content: any) => {
textForUser: any[];
commandsToConfirm: never[];
};
} & PiniaCustomStateProperties< {
wm: WorkerManager;
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
chatHistory: never[];
executor: (content: any) => {
textForUser: any[];
commandsToConfirm: never[];
};
}>) => () => never;
hasModelLoaded: (state: {
wm: {
workers: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
channel: any;
addWorker: (name: string, worker: Worker) => void;
has: (name: string) => boolean;
deleteWorker: (name: string) => void;
sendRequest: (name: string, data: Object) => void;
onError: (name: string, callback: Function) => void;
onResponse: (name: string, callback: Function) => void;
};
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
chatHistory: never[];
executor: (content: any) => {
textForUser: any[];
commandsToConfirm: never[];
};
} & PiniaCustomStateProperties< {
wm: WorkerManager;
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
chatHistory: never[];
executor: (content: any) => {
textForUser: any[];
commandsToConfirm: never[];
};
}>) => boolean;
hasModelOptionsChanged: (state: {
wm: {
workers: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
channel: any;
addWorker: (name: string, worker: Worker) => void;
has: (name: string) => boolean;
deleteWorker: (name: string) => void;
sendRequest: (name: string, data: Object) => void;
onError: (name: string, callback: Function) => void;
onResponse: (name: string, callback: Function) => void;
};
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
chatHistory: never[];
executor: (content: any) => {
textForUser: any[];
commandsToConfirm: never[];
};
} & PiniaCustomStateProperties< {
wm: WorkerManager;
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
chatHistory: never[];
executor: (content: any) => {
textForUser: any[];
commandsToConfirm: never[];
};
}>) => boolean;
}, {
addMessage(role: any, message: any): Promise<void>;
clearMessages(): Promise<void>;
__filterInfo(): never[];
requestChat({ chat_template, tools, documents }: {
chat_template?: null | undefined;
tools?: null | undefined;
documents?: null | undefined;
}): Promise<void>;
requestStreamingChat({ chat_template, tools, documents }: {
chat_template?: null | undefined;
tools?: null | undefined;
documents?: null | undefined;
}): Promise<void>;
requestEmbeddings(type: any, texts: any): Promise<void>;
requestRegenerate(id: any, { chat_template, tools, documents }: {
chat_template?: null | undefined;
tools?: null | undefined;
documents?: null | undefined;
}): Promise<void>;
requestModelLoad(): Promise<void>;
requestReset(): Promise<void>;
saveModelOptions(): Promise<void>;
saveRemoteOptions(): Promise<void>;
saveIsLocal(): Promise<void>;
}>;
export declare const useErrorStore: StoreDefinition<"ErrorStore", {
errors: never[];
}, {
getErrors: (state: {
errors: never[];
} & PiniaCustomStateProperties< {
errors: never[];
}>) => never[];
getLength: (state: {
errors: never[];
} & PiniaCustomStateProperties< {
errors: never[];
}>) => number;
}, {
push(error: any): void;
pop(): void;
clear(): void;
}>;
export declare const useKokoroStore: StoreDefinition<"KokoroStore", {
wm: WorkerManager;
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
audios: Map<any, any>;
pendingChunks: never[];
}, {
getAudios: (state: {
wm: {
workers: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
channel: any;
addWorker: (name: string, worker: Worker) => void;
has: (name: string) => boolean;
deleteWorker: (name: string) => void;
sendRequest: (name: string, data: Object) => void;
onError: (name: string, callback: Function) => void;
onResponse: (name: string, callback: Function) => void;
};
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
audios: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
pendingChunks: never[];
} & PiniaCustomStateProperties< {
wm: WorkerManager;
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
audios: Map<any, any>;
pendingChunks: never[];
}>) => Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
hasModelLoaded: (state: {
wm: {
workers: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
channel: any;
addWorker: (name: string, worker: Worker) => void;
has: (name: string) => boolean;
deleteWorker: (name: string) => void;
sendRequest: (name: string, data: Object) => void;
onError: (name: string, callback: Function) => void;
onResponse: (name: string, callback: Function) => void;
};
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
audios: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
pendingChunks: never[];
} & PiniaCustomStateProperties< {
wm: WorkerManager;
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
audios: Map<any, any>;
pendingChunks: never[];
}>) => boolean;
hasModelOptionsChanged: (state: {
wm: {
workers: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
channel: any;
addWorker: (name: string, worker: Worker) => void;
has: (name: string) => boolean;
deleteWorker: (name: string) => void;
sendRequest: (name: string, data: Object) => void;
onError: (name: string, callback: Function) => void;
onResponse: (name: string, callback: Function) => void;
};
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
audios: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
pendingChunks: never[];
} & PiniaCustomStateProperties< {
wm: WorkerManager;
channel: any;
isModelLoaded: boolean;
isLocal: any;
modelOptions: any;
oldModelOptions: null;
remoteOptions: any;
audios: Map<any, any>;
pendingChunks: never[];
}>) => boolean;
}, {
addAudio(text: any, audio: any): Promise<void>;
getAudio(text: any): Promise<any>;
clearAudios(): Promise<void>;
requestAudioGen(text: any): Promise<void>;
requestStreamingAudioGen(text: any): Promise<void>;
requestModelLoad(): Promise<void>;
requestReset(): Promise<void>;
_mergePendingChunks(text: any): Promise<void>;
saveModelOptions(): Promise<void>;
saveRemoteOptions(): Promise<void>;
saveIsLocal(): Promise<void>;
}>;
/**
* @brief Pinia store to manage a collection of tools and documents embeddings.
*/
export declare const useVectorStore: StoreDefinition<"vectorStore", {
documents: Map<any, any>;
tools: Map<any, any>;
tools_embeddings: Map<any, any>;
documents_embeddings: Map<any, any>;
}, {
/**
* @brief Retrieves a specific document by its title.
* @param {string} key - The title of the document.
* @returns {string|undefined} The content of the document, or undefined if not found.
*/
getDocument: (state: {
documents: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
documents_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
} & PiniaCustomStateProperties< {
documents: Map<any, any>;
tools: Map<any, any>;
tools_embeddings: Map<any, any>;
documents_embeddings: Map<any, any>;
}>) => string | undefined;
/**
* @brief Retrieves all documents as an array of objects.
* @returns {Array<Object>} An array of document objects with `title` and `content`.
*/
getDocuments: (state: {
documents: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
documents_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
} & PiniaCustomStateProperties< {
documents: Map<any, any>;
tools: Map<any, any>;
tools_embeddings: Map<any, any>;
documents_embeddings: Map<any, any>;
}>) => Array<Object>;
/**
* @brief Retrieves all embeddings as an array of objects (key, embeddings)
* @returns {Array<Object>} an array of { key, embeddings }
*/
getDocumentsEmbeddings: (state: {
documents: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
documents_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
} & PiniaCustomStateProperties< {
documents: Map<any, any>;
tools: Map<any, any>;
tools_embeddings: Map<any, any>;
documents_embeddings: Map<any, any>;
}>) => Array<Object>;
/**
* @brief returns the size of documents
* @returns {number}
*/
getDocumentLength: (state: {
documents: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
documents_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
} & PiniaCustomStateProperties< {
documents: Map<any, any>;
tools: Map<any, any>;
tools_embeddings: Map<any, any>;
documents_embeddings: Map<any, any>;
}>) => number;
/**
* @brief Retrieves a specific tool by its description.
* @param {string} key - The description of the tool.
* @returns {string|undefined} The tool or undefined if not found.
*/
getTool: (state: {
documents: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
documents_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
} & PiniaCustomStateProperties< {
documents: Map<any, any>;
tools: Map<any, any>;
tools_embeddings: Map<any, any>;
documents_embeddings: Map<any, any>;
}>) => string | undefined;
/**
* @brief Retrieves all tools as an array of Objects.
* @returns {Array<Object>} An array of tools.
*/
getTools: (state: {
documents: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
documents_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
} & PiniaCustomStateProperties< {
documents: Map<any, any>;
tools: Map<any, any>;
tools_embeddings: Map<any, any>;
documents_embeddings: Map<any, any>;
}>) => Array<Object>;
/**
* @brief Retrieves all embeddings as an array of objects (key, embeddings).
* @returns {Array<Object>} an array of { key, embeddings }
*/
getToolsEmbeddings: (state: {
documents: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
documents_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
} & PiniaCustomStateProperties< {
documents: Map<any, any>;
tools: Map<any, any>;
tools_embeddings: Map<any, any>;
documents_embeddings: Map<any, any>;
}>) => Array<Object>;
/**
* @brief returns the size of tools
* @returns {number}
*/
getToolsLength: (state: {
documents: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
documents_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
} & PiniaCustomStateProperties< {
documents: Map<any, any>;
tools: Map<any, any>;
tools_embeddings: Map<any, any>;
documents_embeddings: Map<any, any>;
}>) => number;
/**
* @brief returns the size of documents + tools
* @returns {number}
*/
getLength: (state: {
documents: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
tools_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
documents_embeddings: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
} & PiniaCustomStateProperties< {
documents: Map<any, any>;
tools: Map<any, any>;
tools_embeddings: Map<any, any>;
documents_embeddings: Map<any, any>;
}>) => number;
}, {
/**
* @brief Adds a new document to the store.
* @param {string} title - The title of the document.
* @param {string} content - The content of the document.
*/
addDocument(title: string, content: string): void;
/**
* @brief adds the embeddings to the store.
* @param {String} title
* @param {Float32Array} embeddings
*/
addDocumentEmbeddings(title: string, embeddings: Float32Array): void;
/**
* @brief Checks if a document exists in the store by its title.
* @param {string} title - The title of the document to check.
* @returns {boolean} `true` if the document exists, otherwise `false`.
*/
hasDocument(title: string): boolean;
/**
* @brief Removes a document from the store by its title.
* @param {string} title - The title of the document to remove.
*/
removeDocument(title: string): void;
/**
* @brief Retrieves all document titles (keys).
* @returns {Array<string>} An array of document titles.
*/
documentsKeys(): Array<string>;
/**
* @brief Maps an array of documents into the store.
* @param {Array<Object>} documents - An array of document objects with `title` and `content`.
* @example
* const docs = [{ title: 'Doc1', content: 'Content1' }, { title: 'Doc2', content: 'Content2' }];
* store.map(docs);
*/
mapDocuments(documents: Array<Object>): void;
/**
* @brief Retrieves the documents titles that are similar to embeddings
* @param {Float32Array} embeddings
* @param {Number} threshold - threshold (default 0.5)
* @returns {Array<String>} the document titles that are similar.
*/
retrieveDocuments(embeddings: Float32Array, threshold?: number): Array<string>;
/**
* @brief adds a new tool to the store.
* @param {String} key - the key of the tool
* @param {Object} tool - the Json Schema for tool
*/
addTool(key: string, tool: Object): void;
/**
* @brief adds the embeddings to the store.
* @param {String} key
* @param {Float32Array} embeddings
*/
addToolEmbeddings(key: string, embeddings: Float32Array): void;
/**
* @brief Checks if a tool exists in the store by its description.
* @param {String} key - the key of the tool to check
* @returns {boolean} `true` if the tool exists, otherwise `false`.
*/
hasTool(key: string): boolean;
/**
* @brief Removes a tool from the store by its key.
* @param {string} key - The key of the tool to remove.
*/
removeTool(key: string): void;
/**
* @brief Retrieves all tools names (keys).
* @returns {Array<string>} An array of tools descriptions.
*/
toolsKeys(): Array<string>;
/**
* @brief maps an array of Tools into the store.
* @param {Array<Object>} tools - tools array
* @param {Function} getKey - Function to get key from tool
*/
mapTools(tools: Array<Object>, getKey?: Function): void;
/**
* @brief Retrieves the tools that are similar to embeddings
* @param {Float32Array} embeddings
* @param {Number} threshold - threshold (default 0.5)
* @returns {Array<Object>} the tools that are similar.
*/
retrieveTools(embeddings: Float32Array, threshold?: number): Array<Object>;
}>;
declare class WorkerManager {
/**
* @brief Constructs a WorkerManager instance.
* @param channel Emitter(mitt) The event emitter used for managing worker events.
*/
constructor(channel: any);
workers: Map<any, any>;
channel: any;
/**
* @brief Adds a worker to the manager and sets up message/error handlers.
* @param name {String} The unique name used to identify the worker.
* @param worker {Worker} The Web Worker instance to be managed.
*/
addWorker(name: string, worker: Worker): void;
/**
* @brief it checks if worker with given name is added.
* @param {String} name The name of the worker to check if added.
* @returns {Boolean} boolean indicating if the worker exists or not.
*/
has(name: string): boolean;
/**
* @brief Removes a worker from the manager and cleans up event listeners.
* @param name {String} The name of the worker to remove.
*/
deleteWorker(name: string): void;
/**
* @brief Sends a request with data to a specific worker.
* @param name {String} The name of the worker to send the request to.
* @param data {Object} The data object to send to the worker.
*/
sendRequest(name: string, data: Object): void;
/**
* @brief Registers an error callback for a specific worker.
* @param name {String} The name of the worker to listen for errors from.
* @param callback {Function} The function to call when an error occurs.
*/
onError(name: string, callback: Function): void;
/**
* @brief Registers a response callback for a specific worker.
* @param name {String} The name of the worker to listen for responses from.
* @param callback {Function} The function to call when a response is received.
*/
onResponse(name: string, callback: Function): void;
}
export { }