chroma-core / chroma

the AI-native open-source embedding database
https://www.trychroma.com/
Apache License 2.0
15.51k stars 1.3k forks source link

[Feature Request]: $contains for metadata or allow type list for metadata and have $in for lists as filter option #3153

Open pascalovrai opened 4 days ago

pascalovrai commented 4 days ago

Describe the problem

I would be awesome if you could use the $contains filter on metadata. Or if you could have a list as an allowed type for metadata, to then use a kind of $in operator.

Describe the proposed solution

So let's say I have a list of tags ("Bestseller", "Beginner-Friendly", "Budget-Friendly"). Now I have the metadata field "Tags" and there I would like to make the value of the field a list -> ["Bestseller", "Beginner-Friendly", "Budget-Friendly"]. Now if I want to look for all documents that are bestsellers, I would just have to do {"Tags": {"$in": "Bestseller"}}.

Alternatives considered

Or the same for $contains. Where you would not have to have a list as the metadata field type, but you could have a string.

Importance

i cannot use Chroma without it

Additional Information

I love Chroma DB and have been using it for around a year now and this feature would be soo life saving!!!

Sicheng-Pan commented 1 day ago

Hi! Currently Chroma does not support compound metadata value (such as a list). But for your use case it is possible to get around without using a list as value type. For example: