Skip to content

Multiple Filters using Chroma().as_retriever #10537

Answered by dosubot bot
jacobbamio asked this question in Q&A
Discussion options

You must be logged in to vote

🤖

Hello,

Thank you for using LangChain and ChromaDB. I understand you're having trouble with multiple filters using the as_retriever method.

Based on the issues and solutions I found in the LangChain repository, it seems that the filter argument in the as_retriever method should be able to handle multiple filters. However, the syntax you're using might not be correct.

Here's how you can use multiple filters:

retriever = DB.as_retriever(search_kwargs={"k": int(get_env_var('TARGET_SOURCE_CHUNKS')),
                                           "filter":{'$or': [{'user_id': {'$eq': user_id}},
                                                              {'category_id': {'$eq': cat_id}}]}})

This…

Replies: 7 comments 9 replies

Comment options

You must be logged in to vote
5 replies
@keiru517
Comment options

@zhangZZZ-v
Comment options

@jacobbamio
Comment options

@keiru517
Comment options

@keiru517
Comment options

Answer selected by jacobbamio
Comment options

You must be logged in to vote
1 reply
@keiru517
Comment options

Comment options

You must be logged in to vote
1 reply
@chelun86
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Robs-Git-Hub
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ad092
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
9 participants