hnswsqlite
Version:
Vector search with HNSWlib and SQLite in TypeScript.
15 lines (13 loc) • 436 B
text/typescript
import { VectorStore } from '../src/vectorStore';
describe('VectorStore', () => {
it('should add and search documents', () => {
const store = new VectorStore(':memory:', 4);
const emb1 = [1, 2, 3, 4];
const emb2 = [2, 3, 4, 5];
store.addDocument('doc1', emb1);
store.addDocument('doc2', emb2);
const results = store.search(emb1, 2);
expect(results.length).toBeGreaterThan(0);
store.close();
});
});