Skip to content

Vector Stores

Available Vector stores save embedding vectors of your ingested document chunks.

Most vector stores in this library support the following search modes:

  • Default: Standard vector similarity search using embeddings.
  • BM25: Keyword search using the BM25 algorithm.
  • Hybrid: A combination of vector similarity search and BM25 keyword search.

The score returned for each node depends on the search mode used:

  • Default (Vector): Scores are based on cosine similarity and range from 0.0 to 1.0, where 1.0 indicates a perfect semantic match.
  • BM25: Scores are calculated using the BM25 algorithm. These scores are unbounded (can be greater than 1.0) and represent keyword relevance. Higher scores indicate better matches.
  • Hybrid: Scores are calculated using Reciprocal Rank Fusion (RRF). RRF scores are typically very small (e.g., a rank 1 result has a score of $\approx 0.0164$ or $1.64%$). This method is robust as it only considers the rank position from each sub-search, not the raw similarity or BM25 scores.

You can specify the search mode in the query method of the vector store:

const result = await vectorStore.query({
queryStr: "your keyword query",
queryEmbedding: [0.1, 0.2, ...],
mode: "hybrid",
similarityTopK: 5,
alpha: 0.5, // Importance of vector search vs keyword search (0.0 to 1.0)
});

Where possible, this library uses the native hybrid and BM25 implementations of the underlying vector store (e.g., Weaviate, ElasticSearch, MongoDB Atlas, PostgreSQL). If a vector store does not support these modes natively, a fallback implementation is used where possible.

Available Vector Stores are shown on the sidebar to the left. Additionally the following integrations exist without separate documentation:

Check the vectorstores Github for the most up to date overview of integrations.