Skip to content

Vector stores

By default RAGLite keeps vectors in memory and saves them as JSON files under storeDir. It needs nothing else to run. For large indexes, or to share an index between machines, set vectorStore.

Store provider TypeScript Python Extra install
Memory (default) memory ✓ ✓ none
Qdrant qdrant ✓ ✓ none
Pinecone pinecone ✓ ✓ none
LanceDB lancedb ✓ — npm install @lancedb/lancedb
new Document("./policy.pdf", { vectorStore: { provider: "memory", storeDir: ".raglite" } });

Works with a local Qdrant (for example in Docker) or Qdrant Cloud. Each document gets its own collection, raglite_<namespace>. Set indexName to keep many documents in one shared collection: each point is tagged with its document’s namespace, so rebuilding one document never affects the others.

new Document("./policy.pdf", {
vectorStore: {
provider: "qdrant",
url: "http://localhost:6333", // or your Qdrant Cloud URL
apiKey: process.env.QDRANT_API_KEY, // optional
indexName: "company_docs", // optional
},
});

Each document is stored in its own Pinecone namespace inside the index. url is the index host.

new Document("./policy.pdf", {
vectorStore: {
provider: "pinecone",
url: "https://your-index-host.svc.pinecone.io",
apiKey: process.env.PINECONE_API_KEY,
},
});

An embedded database on the local filesystem, in <storeDir>/lancedb.

new Document("./policy.pdf", { vectorStore: { provider: "lancedb", storeDir: ".raglite" } });

Hybrid search keeps its keyword index under storeDir, even with Qdrant or Pinecone. Keep storeDir on persistent disk, or the keyword index is lost on restart and keyword search falls back to vector search until you rebuild.

With a DocumentCollection, pass a provider config as above, never a store instance. See Collections.

Implement the VectorStore interface and pass an instance as vectorStore.

import { Document, type VectorStore } from "raglite-toolkit";
class MyStore implements VectorStore {
// Required: namespace, load, reset, add, search, count, saveIndexMetadata, readIndexMetadata
// Optional: listChunks() lets hybrid search rebuild a missing keyword index from your store;
// keywordSearch(query, topK) replaces the built-in BM25 index with your own.
}
new Document("./policy.pdf", { vectorStore: new MyStore() });

search receives a third argument, filter, holding the metadata filter conditions on per-chunk fields (chunk, totalChunks, page, pageEnd, section). Apply it before the topK cut; matchesFilter(metadata, filter) (matches_filter in Python) checks one chunk. A store that ignores it still returns correct results, because RAGLite filters the results again, but a filtered search may then return fewer than topK. keywordSearch takes the same argument.

To extend a built-in store, import MemoryVectorStore, QdrantVectorStore, PineconeVectorStore or LanceDbVectorStore from raglite-toolkit, or the first three from raglite.vectordb in Python.