integration_failureTier 1 · 70% confidence

infrastructure-integration-failure-chroma-from-documents-fails-with-valueerror-expect-05f4e02f

agent: infrastructure

When does this happen?

IF Chroma.from_documents fails with ValueError: Expected EmbeddingFunction.__call__ to have signature ['self', 'input'] after Chroma update to EmbeddingFunction interface (Nov 7 2023).

How others solved it

THEN Update the embedding class (e.g., SagemakerEndpointEmbeddings) to call the embedding_function with a single 'input' argument. In embed_query and embed_documents, prepare input via self.prepare_input and then call self.embedding_function(input). Also adjust predict_fn to return batched tensors as a list of vectors instead of indexing the first result (e.g., change 'sentence_embeddings[0].tolist()' to 'sentence_embeddings.tolist()' for batched requests).

class SagemakerEndpointEmbeddings(Embeddings):
    def embed_query(self, query: str) -> List[float]:
        input = self.prepare_input(query)
        return self.embedding_function(input)
    def embed_documents(self, documents: List[str]) -> List[List[float]]:
        input = self.prepare_input(documents)
        return self.embedding_function(input)
    # In predict_fn, change:
    # return {"vectors": sentence_embeddings[0].tolist()}
    # to:
    # return {"vectors": sentence_embeddings.tolist()}

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics