Replies: 2 comments
-
🤖 Hello @snbhanja, I'm here to assist you with your question. To pass the metadata filter condition such as {"file_name": "abc.pdf"} when using chromadb in a chat engine, you can use the from llama_index.vector_stores.types import MetadataFilters
from llama_index.vector_stores.chroma import _to_chroma_filter
filters = MetadataFilters(
filters=[{"key": "file_name", "value": "abc.pdf"}]
)
chroma_filters = _to_chroma_filter(filters)
retriever = index.as_retriever(filters=chroma_filters)
retriever.retrieve("What is inception about?") In this code, You can find more details in the docs/examples/vector_stores/chroma_metadata_filter.ipynb and llama_index/vector_stores/chroma.py files in the LlamaIndex repository. I hope this helps! If you have any more questions, feel free to ask. Best, 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. |
Beta Was this translation helpful? Give feedback.
-
Take a look at https://docs.llamaindex.ai/en/stable/optimizing/basic_strategies/basic_strategies.html#metadata-filters |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Question Validation
Question
Hi, I am facing an issue, how do I pass the metadata filter condition here? like, {"file_name": "abc.pdf"}
It is not clear from the documentation either.
Beta Was this translation helpful? Give feedback.
All reactions