diff --git a/integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py b/integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py index addcba296..3353ed5aa 100644 --- a/integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py +++ b/integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py @@ -6,7 +6,6 @@ from typing import Any, Dict, List, Literal, Optional, Tuple import chromadb -import numpy as np from chromadb.api.types import GetResult, QueryResult, validate_where, validate_where_document from haystack import default_from_dict, default_to_dict from haystack.dataclasses import Document @@ -465,7 +464,7 @@ def _query_result_to_documents(result: QueryResult) -> List[List[Document]]: pass if embeddings := result.get("embeddings"): - document_dict["embedding"] = np.array(embeddings[i][j]) + document_dict["embedding"] = embeddings[i][j] if distances := result.get("distances"): document_dict["score"] = distances[i][j] diff --git a/integrations/chroma/tests/test_document_store.py b/integrations/chroma/tests/test_document_store.py index d4b6ed272..5a7e12b3d 100644 --- a/integrations/chroma/tests/test_document_store.py +++ b/integrations/chroma/tests/test_document_store.py @@ -106,7 +106,12 @@ def test_search(self): # Assertions to verify correctness assert len(result) == 1 - assert result[0][0].content == "Third document" + doc = result[0][0] + assert doc.content == "Third document" + assert doc.meta == {"author": "Author2"} + assert doc.embedding + assert isinstance(doc.embedding, list) + assert all(isinstance(el, float) for el in doc.embedding) def test_write_documents_unsupported_meta_values(self, document_store: ChromaDocumentStore): """