-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support named vectors in Qdrant #6871
Support named vectors in Qdrant #6871
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Your approach over mine allows the following:
My approach in my second PR #5975 allows both scenarios but expands first to allow adding documents to collections that define multiple vector keys. Now, my use case is already fulfilled with your work, because my use of |
langchain/vectorstores/qdrant.py
Outdated
with_payload=True, | ||
with_vectors=True, | ||
limit=fetch_k, | ||
) | ||
embeddings = [result.vector for result in results] | ||
mmr_selected = maximal_marginal_relevance( | ||
np.array(embedding), embeddings, k=k, lambda_mult=lambda_mult | ||
np.array(query_vector), embeddings, k=k, lambda_mult=lambda_mult |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we probably don't want to pass in vector_name to this, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dev2049 Thanks for pointing this out! This was not covered well in the tests, so I extended them and fixed the issues. I would appreciate another look!
We should not expose the vector configuration to the Langchain users. If anyone wants to use a custom configuration for their collection, it should be created directly with |
lgtm |
# Description This PR makes it possible to use named vectors from Qdrant in Langchain. That was requested multiple times, as people want to reuse externally created collections in Langchain. It doesn't change anything for the existing applications. The changes were covered with some integration tests and included in the docs. ## Example ```python Qdrant.from_documents( docs, embeddings, location=":memory:", collection_name="my_documents", vector_name="custom_vector", ) ``` ### Issue: #2594 Tagging @rlancemartin & @eyurtsev. I'd appreciate your review.
# Description This PR makes it possible to use named vectors from Qdrant in Langchain. That was requested multiple times, as people want to reuse externally created collections in Langchain. It doesn't change anything for the existing applications. The changes were covered with some integration tests and included in the docs. ## Example ```python Qdrant.from_documents( docs, embeddings, location=":memory:", collection_name="my_documents", vector_name="custom_vector", ) ``` ### Issue: langchain-ai#2594 Tagging @rlancemartin & @eyurtsev. I'd appreciate your review.
Description
This PR makes it possible to use named vectors from Qdrant in Langchain. That was requested multiple times, as people want to reuse externally created collections in Langchain. It doesn't change anything for the existing applications. The changes were covered with some integration tests and included in the docs.
Example
Issue: #2594
Tagging @rlancemartin & @eyurtsev. I'd appreciate your review.