vault-ai
vault-ai copied to clipboard
Alternate vector databases (qdrant)
I wanted to try vault-ai but wanted to be able to run my vector database locally. qdrant
seemed reasonable and was very easy to get set up (cargo run
pretty much did it) so I gave that a shot.
Some notes:
- Made a
VectorDB
interface that exposesUpsertEmbeddings
andRetrieve
. This interface is pretty simplistic but was enough to get going and could be built out more later if other databases actually need more functionality - Made a
HandlerContext
struct that holds the openai client and vectordb instance (whether an instance of pinecone or qdrant). It means thatmain
can create the context which holds most of the state of the app and does not need global variables. - qdrant API is close enough to pinecone's, but does not automatically create new collections. Added some code to check if the collection exists (looking at local cache first) and if not, create it.
Doesn't exactly address #6 but may help solve the issue for some people.
@mnutt This is an awesome PR – I'll test it + merge. Great work!
Thanks! I just tried it with a much larger document and realized I needed to update points in batches, added that just now.
please merge this pr
I tested this with pinecone and after a small fix everything worked great! Thanks for the PR. I have not tested this with qdrant, but I trust that you have :)
@mnutt cc @nbdy-coder may I ask you to add a PR that adds some documentation to the README.md
file about how to setup qdrant? It would be super helpful for new people. Thanks again @mnutt for the contribution :)