Open P1et1e opened 8 months ago
Can be resolved by adding query_embeddings = [[float(elem) for elem in query_embeddings[0]]] to _query().
def _query( self, collection_id: UUID, query_embeddings: Embeddings, n_results: int = 10, where: Optional[Where] = {}, where_document: Optional[WhereDocument] = {}, include: Include = ["metadatas", "documents", "distances"], ) -> QueryResult: """Gets the nearest neighbors of a single embedding""" query_embeddings = [[float(elem) for elem in query_embeddings[0]]] resp = self._session.post( self._api_url + "/collections/" + str(collection_id) + "/query", data=json.dumps(
@P1et1e, Chroma does not support f64 embeddings. The underlying hnsw lib and by extension everything else in Chroma is f32. If I recall correctly we do have NPArrays as input to the local and http APIs.
@tazarov Actually i am using LlamaIndex and AzureOpenAIEmbedding to generate the Embeddings. With the Persistent Client everything works fine. With the HttpClient and the ChromaDB Docker Container I received the Error. Actually I don't know exactly where the numpy.float64 is coming from.
@P1et1e, thanks for explaining. I'll have a look
this fast solution might help https://github.com/chroma-core/chroma/pull/1930/commits/fc161984600ca119d28511faaf3a2b291492f096
What happened?
Using chromadb.HttpClient with LllamaIndex chat_engine.stream_chat(). stream_chat execution leads to TypeError: Type is not JSON serializable: numpy.float64 triggered within chromadb/api/fastapi.py Running ChromaDB Docker Container with chromadb/chroma:0.4.23 image
Versions
Chroma v.0.4.23, Python 3.10.12, Ubuntu 22.04, chromadb/chroma:0.4.23 docker image
Relevant log output