Chroma - The meta in write_documents only supports str, int, float, bool, but not list. However, its search filter does support list.
#DUG Describe When using ChromaDocumentStore from Haystack integrations, the write_documents method does not support storing list values in metadata fields, only supporting str, int, float, and bool types. However, during query operations, the system does support list values in filters, creating an inconsistency between write and read operations.
##Steps to reproduce the behavior: Import ChromaDocumentStore: from haystack_integrations.document_stores.chroma import ChromaDocumentStore Create a document with list metadata: doc.metadata = {"countries": ["UK", "US"]} Attempt to write document: document_store.write_documents([doc]) Get validation error: ValueError: Expected metadata value to be a str, int, float or bool
##Expected behavior: The write_documents method should support list values in metadata to maintain consistency with query operations that already support list filtering.
##Additional context The query method search_embeddings supports list values in filters parameter. This creates a mismatch between data ingestion and query capabilities. Workarounds currently require serializing list data to strings before storage.
##Possible Solution Suggest either: Remove the type restriction in write_documents validation. Add automatic serialization/deserialization for list values. Extend supported types to include list and dict.
Environment Haystack version: 0.42.0 chroma-haystack: 3.1.0 Python version: 3.10 OS: Windows
Thank you for opening this issue @King-pand ! We'll discuss in our engineering team if we can prioritize this issue for one of our next sprints. In the mean time, feel free to give it a shot if you would like to contribute to Haystack! Guidelines are here.
Just a side note: In the issue, you mention Haystack version 0.42.0. This is a mix up of https://pypi.org/project/haystack/ and https://pypi.org/project/haystack-ai/ I assume you are using Haystack version 2.17 or 2.16.