Closed gottlike closed 1 year ago
@gottlike I can see that the result that comes back does include content
for 2 recipes, so the vectors are making it into Qdrant. Is the expectation that you get back the vectors themselves too? Sorry, I'm not too familiar with this, but I can probably help.
I believe this call needs to include with_vector: true
. See the gem docs: https://github.com/andreibondarev/qdrant-ruby#points
As far as I understand Qdrant offers "normal" search via payload
data and vector search functionality. I'm no expert myself, but from what I get back from Qdrant it just seems that it's not having any vectors/embeddings. Also in the GUI there's no vectors for the items:
I just hardcoded it, it's on the main
branch. Could you please try it out?
@andreibondarev That worked for me, but I assume someone should check in the GUI. I don't know how to check that yet.
Yep, it worked! Still nothing in the Qdrant GUI, but the response I'm getting back now is looking good.
Then the only thing left would be a check for existing collections to prevent the error.
@gottlike Does the error on create_default_schema
cause a problem for you?
3.2.1 :023 > qdrant.create_default_schema
=> {"status"=>{"error"=>"Wrong input: Collection `Recipe` already exists!"}, "time"=>0.000206}
@gottlike What if there exists a collection with the same name but different config? Any reason why this error wouldn't be handled in your application?
It's not really a problem, but in my eyes it would be much cleaner to not catch errors and do a proper check instead. So maybe it would be enough to just have methods for checking and creating a collection, instead of the create_default_schema
?
@gottlike Want to take a stab at creating the PR? I would just encourage thinking through how this same method can also exist for all of the other supported vector search DBs since we aim to have a common interface here for all of them.
@andreibondarev Not sure if it fits the other databases, but I'll have a look tomorrow and see if I can come up with something usable.
@andreibondarev I just opened a PR for handling this a bit smoother in Qdrant. Is something like this feasible for the other databases, too?
Edit: Oops, just deleted my fork accidentally, but the code is still there for you to check.
@gottlike I think instead maybe we can introduce a def schema
to just get an existing schema or nil back. You can then use it to decide whether you want to call create_default_schema()
or not. How does that sound?
@andreibondarev Sounds like an even better solution 👍
@gottlike I went ahead and added the get_default_schema()
method to most of the vector DBs: https://github.com/andreibondarev/langchainrb/pull/235.
Please let us know if there's any other issues! I'm closing this issue for now.
@andreibondarev Awesome, thanks!
I never used Qdrant, but when using this simple example:
I get the following result back:
Note that the vectors are
nil
for both results. The embeddings are apparently created, since it takes a bit to ingest the text samples, but the vectors are not put into Qdrant.Another thing to improve: Using
qdrant.create_default_schema
throws an error when the collection was already created. Would make sense to check first if the collection exists and only then try to create it.