Weaviate is an open-source vector database. It allows you to store data objects and vector embeddings from your favorite ML models, and scale seamlessly into billions of data objects.In the notebook, we’ll demo the
SelfQueryRetriever
wrapped around a Weaviate
vector store.
Creating a Weaviate vector store
First we’ll want to create a Weaviate vector store and seed it with some data. We’ve created a small demo set of documents that contain summaries of movies. Note: The self-query retriever requires you to havelark
installed (pip install lark
). We also need the weaviate-client
package.
Creating our self-querying retriever
Now we can instantiate our retriever. To do this we’ll need to provide some information upfront about the metadata fields that our documents support and a short description of the document contents.Testing it out
And now we can try actually using our retriever!Filter k
We can also use the self query retriever to specifyk
: the number of documents to fetch.
We can do this by passing enable_limit=True
to the constructor.