vault-ai icon indicating copy to clipboard operation
vault-ai copied to clipboard

Alternate vector databases (qdrant)

Open mnutt opened this issue 1 year ago • 3 comments

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 exposes UpsertEmbeddings and Retrieve. 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 that main 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.

mnutt avatar May 08 '23 05:05 mnutt

Doesn't exactly address #6 but may help solve the issue for some people.

mnutt avatar May 08 '23 05:05 mnutt

@mnutt This is an awesome PR – I'll test it + merge. Great work!

pashpashpash avatar May 08 '23 19:05 pashpashpash

Thanks! I just tried it with a much larger document and realized I needed to update points in batches, added that just now.

mnutt avatar May 08 '23 21:05 mnutt

please merge this pr

nbdy-coder avatar Jun 13 '23 06:06 nbdy-coder

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 :)

pashpashpash avatar Jun 18 '23 00:06 pashpashpash

@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 :)

pashpashpash avatar Jun 18 '23 01:06 pashpashpash