-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Feature Request: Implement MMR Search in Qdrant Database for LangChain #3676
Comments
🤖 Hello @Kubululo! It's nice to meet you on GitHub. I'm Dosu, a friendly bot here to assist you. While we wait for a human maintainer, I'm here to help you with bug solutions, answer any queries you might have, and guide you on your journey to becoming a contributor. Let's dive into code and collaboration together! Thank you for your feature request. Implementing Maximal Marginal Relevance (MMR) search within the Qdrant database framework in LangChain is indeed possible and would certainly enhance the document retrieval capabilities of LangChain. Currently, LangChain's Qdrant integration supports a form of search functionality, as evident in the Here is the code snippet that supports this: async similaritySearchVectorWithScore(
query: number[],
k?: number,
filter?: QdrantSchemas["Filter"]
): Promise<[Document, number][]> {
if (!query) {
return [];
}
await this.ensureCollection();
const results = await this.client.search(this.collectionName, {
vector: query,
limit: k,
filter,
});
const result: [Document, number][] = (
results as QdrantSearchResponse[]
).map((res) => [
new Document({
metadata: res.payload.metadata,
pageContent: res.payload.content,
}),
res.score,
]);
return result;
} Source: libs/langchain-community/src/vectorstores/qdrant.ts To implement MMR search in Qdrant, a similar method would need to be created in the Qdrant vector store class. This method would use Qdrant's search functionality to find the most relevant documents, and then apply the MMR algorithm to rank the results. As an example, here is how MMR search is implemented in the Supabase vector store: const resultOne = await vectorStore.maxMarginalRelevanceSearch(
"Hello world",
{ k: 1 }
); Source: examples/src/indexes/vector_stores/supabase_with_maximum_marginal_relevance.ts This feature request is valuable and would bring Qdrant's functionality in line with other supported vector stores in LangChain. However, as a technical support rep, I'm unable to create pull requests or issues. I recommend reaching out to the maintainers of the LangChain repository with this feature request. I hope this information is helpful. If you have any further questions, please don't hesitate to ask. Best regards, Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Any update? |
I hope this can be reopened and implemented. It seems that Qdrant themselves support it with their client, and LangChain Python supports a number of different flavors of it too: https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.qdrant.Qdrant.html#langchain_community.vectorstores.qdrant.Qdrant.amax_marginal_relevance_search |
Title: Add MMR Search Capability to Qdrant in LangChain
Details:
Requesting the implementation of Maximal Marginal Relevance (MMR) search within the Qdrant database framework in LangChain. MMR search, already present in other vector stores in LangChain, is currently missing in the Qdrant integration. This addition would enhance document retrieval capabilities by providing diverse and relevant results, bringing Qdrant's functionality in line with other supported vector stores in LangChain.
The text was updated successfully, but these errors were encountered: