closevector-web
Version:
CloseVector is fundamentally a vector database. We have made dedicated libraries available for both browsers and node.js, aiming for easy integration no matter your platform. One feature we've been working on is its potential for scalability. Instead of b
40 lines (32 loc) • 902 B
text/typescript
import { loadHnswlib } from 'closevector-hnswlib-wasm';
export * from './lib';
export * from './closeVectorEmbedding'
export * from './hnswlibWasm'
export * from './loader'
export * from './embeddings'
export * from './manager'
export function isWasmSupport() {
return typeof WebAssembly === 'object' && typeof WebAssembly.instantiate === 'function';
}
export function isIndexedDBSupport() {
return typeof indexedDB === 'object';
}
export async function loadHnswlibWasm(
options: {
debug: boolean;
} = {
debug: false,
}
) {
if (!isWasmSupport()) {
throw new Error('WebAssembly is not supported');
}
if (!isIndexedDBSupport()) {
throw new Error('IndexedDB is not supported');
}
const lib = await loadHnswlib();
if (options.debug) {
lib.EmscriptenFileSystemManager.setDebugLogs(true);
}
return lib;
}