{"record":{"id":"2bd8484f11c93217","repo":"chroma-core/chroma","slug":"the-provided-embedding-function-does-not-support-i","errorCode":null,"errorMessage":"The provided embedding function does not support image embeddings.","messagePattern":"The provided embedding function does not support image embeddings\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/utils/embedding_functions/chroma_langchain_embedding_function.py","lineNumber":99,"sourceCode":"        Returns:\n            The embedding for the query.\n        \"\"\"\n        return cast(List[float], self.embedding_function.embed_query(query))\n\n    def embed_image(self, uris: List[str]) -> List[List[float]]:\n        \"\"\"\n        Embed images using the langchain embedding function.\n\n        Args:\n            uris: The URIs of the images to embed.\n\n        Returns:\n            The embeddings for the images.\n        \"\"\"\n        if hasattr(self.embedding_function, \"embed_image\"):\n            return cast(List[List[float]], self.embedding_function.embed_image(uris))\n        else:\n            raise ValueError(\n                \"The provided embedding function does not support image embeddings.\"\n            )\n\n    def __call__(self, input: Union[Documents, Images]) -> Embeddings:\n        \"\"\"\n        Get the embeddings for a list of texts or images.\n\n        Args:\n            input: A list of texts or images to get embeddings for.\n                Images should be provided as a list of URIs passed through the langchain data loader\n\n        Returns:\n            The embeddings for the texts or images.\n\n        Example:\n            >>> from langchain_openai import OpenAIEmbeddings\n            >>> langchain_embedding = ChromaLangchainEmbeddingFunction(embedding_function=OpenAIEmbeddings(model=\"text-embedding-3-large\"))\n            >>> texts = [\"Hello, world!\", \"How are you?\"]","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/utils/embedding_functions/chroma_langchain_embedding_function.py#L81-L117","documentation":"ChromaLangchainEmbeddingFunction.embed_image checks hasattr(self.embedding_function, \"embed_image\") and raises ValueError when the wrapped langchain object lacks that method. Most langchain Embeddings implementations are text-only; only multimodal ones (e.g. CLIP-style embedders) implement embed_image, so image embedding via this bridge is opt-in by the underlying class.","triggerScenarios":"Invoking the EF with image input — __call__ routes tuples of the form (\"images\", [uris]) to embed_image — while the wrapped embedding function (e.g. OpenAIEmbeddings) has no embed_image attribute. Also triggered by calling ef.embed_image(uris) directly.","commonSituations":"Feeding image URIs through the langchain data loader into a collection whose EF was built with a text-only embedder; multimodal prototypes where the langchain class implements embed_image under a different name; upgrading langchain versions where a custom embed_image was renamed.","solutions":["Use a text-only path: embed text (captions/OCR) instead of images with this function.","Wrap a multimodal langchain embedding class that implements embed_image(uris) (or subclass it and add the method).","For image support independent of langchain, use a chromadb embedding function that natively supports images."],"exampleFix":"# before\nef = create_langchain_embedding(OpenAIEmbeddings())  # text-only\nvecs = ef((\"images\", [\"file:///tmp/cat.png\"]))  # ValueError: no image support\n\n# after: custom class adding embed_image\nclass MyMultimodal(OpenAIEmbeddings):\n    def embed_image(self, uris):\n        return [self.client.images.embed(...) for u in uris]  # your model call\n\nef = create_langchain_embedding(MyMultimodal())\nvecs = ef((\"images\", [\"file:///tmp/cat.png\"]))","handlingStrategy":"type-guard","validationCode":"def can_embed_images(ef) -> bool:\n    return hasattr(ef.embedding_function, \"embed_image\")\n\nif not can_embed_images(ef):\n    raise ValueError(\"Switch to a multimodal embedding function before ingesting images\")","typeGuard":"from typing import Protocol\n\nclass SupportsImageEmbedding(Protocol):\n    def embed_image(self, uris: list[str]) -> list[list[float]]: ...\n\ndef supports_image_embeddings(ef) -> bool:\n    \"\"\"True when the wrapped langchain function can embed images.\"\"\"\n    return hasattr(ef.embedding_function, \"embed_image\")","tryCatchPattern":"try:\n    vecs = ef((\"images\", uris))\nexcept ValueError as e:\n    if \"does not support image embeddings\" in str(e):\n        uris = None  # fall back to a text pipeline (captions/OCR) instead of failing\n    else:\n        raise","preventionTips":["Check hasattr(embedding_function, 'embed_image') once at startup for image pipelines.","Keep text-only models out of image ingestion paths at the configuration level.","Name custom multimodal wrapper methods exactly embed_image so the bridge detects them."],"tags":["langchain","multimodal","image-embeddings","embedding-function"],"backgroundTag":"unsupported-operation","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}