langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Qdrant filtering methods

Open dagthomas opened this issue 2 years ago • 2 comments

Feature request

The qdrant vector store has "must" in filter, is it possible to add "must_not" and/or "should" as well?

Ref: https://qdrant.tech/documentation/filtering/

Motivation

Having a filter is really nice, but its hard to use row level authorization without "must_not"

So we can say "must" include ID and "must_not" include ID2

To be able to filter correctly

Your contribution

I am a front-end developer, and hoping someone with python competance can handle this.

dagthomas avatar May 15 '23 10:05 dagthomas

What if you changed the API so a user passes the rest.Filter directly (instead of MetadataFilter)? This way, you won't need to implement different filtering options (must, must_not, nested, etc.) Qdrant documentation shows how to do that and gives Python examples anyways...

hp0404 avatar May 15 '23 21:05 hp0404

I also faced an issue when trying to do filtering with qdrant. Here is how I solved it temporarily. (#5073 ) It should allow you to pass any filters provided by qdrant. Just copy paste their python examples.

YLFxGen avatar May 23 '23 06:05 YLFxGen

@dagthomas @hp0404 @YLFxGen This has been implemented in #5446.

kacperlukawski avatar May 31 '23 12:05 kacperlukawski

@dagthomas @hp0404 @YLFxGen This has been implemented in #5446.

Great job, thank you!

dagthomas avatar Jun 01 '23 08:06 dagthomas

Hi, @dagthomas! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, you requested the addition of "must_not" and/or "should" filtering methods to the qdrant vector store for more flexible filtering and row level authorization. There have been some discussions and suggestions in the comments, including changing the API to pass the rest.Filter directly instead of MetadataFilter. YLFxGen also shared a temporary solution for filtering with qdrant.

However, it seems that the feature you requested has already been implemented in issue #5446, which received positive reactions from hp0404 and yourself.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.

Thank you for your contribution to the LangChain repository!

dosubot[bot] avatar Sep 12 '23 16:09 dosubot[bot]