The MatryoshkaRetrieval retriever performs two semantic searches. The first uses the smaller
store which returns many results, but is less accurate. Then, using the documents returned
from the smaller store, the larger store is used to perform a more accurate search over the
smaller set of documents.
The vector store must contain an id field in the metadata of each document. This is used to
filter the results from the large store. You may override this metadata key by passing a
custom idKey to the constructor.
A retriever that uses two stores, a large and small (dictated by their dimensions) to retrieve documents.
Based off of the "Matryoshka embeddings: faster OpenAI vector search using Adaptive Retrieval" blog post https://supabase.com/blog/matryoshka-embeddings.
The MatryoshkaRetrieval retriever performs two semantic searches. The first uses the smaller store which returns many results, but is less accurate. Then, using the documents returned from the smaller store, the larger store is used to perform a more accurate search over the smaller set of documents.
The vector store must contain an
id
field in the metadata of each document. This is used to filter the results from the large store. You may override this metadata key by passing a customidKey
to the constructor.