Open Georgehe4 opened 3 hours ago
The issue you're encountering is due to a change in ChromaDb's handling of the 'where' parameter. The error message indicates that the 'where' parameter is expected to have exactly one operator, but it is currently being passed as an empty dictionary {}
. This is likely because the default value for the 'where' parameter is not being set correctly in the LlamaIndex integration with ChromaDb.
To resolve this, you need to ensure that the 'where' parameter is properly initialized with a valid operator when no filters are provided. In the LlamaIndex codebase, the query
method should set the where
parameter to a default value that includes a valid operator, rather than an empty dictionary. You can modify the code to include a default operator, such as "$and": []
, to satisfy the new requirement in ChromaDb.
Here's a potential fix in the query
method:
def query(self, query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult:
...
if query.filters is not None:
where = _to_chroma_filter(query.filters)
else:
where = kwargs.pop("where", {"$and": []}) # Set a default operator
...
This change ensures that the 'where' parameter always contains a valid operator, even when no specific filters are applied.
To continue talking to Dosu, mention @dosu.
I think the best option would be to check if we can update ChromaDb to support empty where {} again.
Bug Description
Reproducible using colab code at https://docs.llamaindex.ai/en/stable/examples/vector_stores/ChromaIndexDemo/
Breaking change in ChromaDb: https://github.com/chroma-core/chroma/pull/2899
Issue: We're now no longer passing the default into ChromaDb's 'where' handler: https://github.com/run-llama/llama_index/blob/35a13b96a61bbbbab026e1b8c5465d10dff0a759/llama-index-integrations/vector_stores/llama-index-vector-stores-chroma/llama_index/vector_stores/chroma/base.py#L258
Version
0.11
Steps to Reproduce
Reproducible using colab code at https://docs.llamaindex.ai/en/stable/examples/vector_stores/ChromaIndexDemo/
Relevant Logs/Tracbacks