chroma-core/chroma · error · ValueError

The provided embedding function does not support image embed

Error message

The provided embedding function does not support image embeddings.

What it means

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.

Source

Thrown at chromadb/utils/embedding_functions/chroma_langchain_embedding_function.py:99

        Returns:
            The embedding for the query.
        """
        return cast(List[float], self.embedding_function.embed_query(query))

    def embed_image(self, uris: List[str]) -> List[List[float]]:
        """
        Embed images using the langchain embedding function.

        Args:
            uris: The URIs of the images to embed.

        Returns:
            The embeddings for the images.
        """
        if hasattr(self.embedding_function, "embed_image"):
            return cast(List[List[float]], self.embedding_function.embed_image(uris))
        else:
            raise ValueError(
                "The provided embedding function does not support image embeddings."
            )

    def __call__(self, input: Union[Documents, Images]) -> Embeddings:
        """
        Get the embeddings for a list of texts or images.

        Args:
            input: A list of texts or images to get embeddings for.
                Images should be provided as a list of URIs passed through the langchain data loader

        Returns:
            The embeddings for the texts or images.

        Example:
            >>> from langchain_openai import OpenAIEmbeddings
            >>> langchain_embedding = ChromaLangchainEmbeddingFunction(embedding_function=OpenAIEmbeddings(model="text-embedding-3-large"))
            >>> texts = ["Hello, world!", "How are you?"]

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. Use a text-only path: embed text (captions/OCR) instead of images with this function.
  2. Wrap a multimodal langchain embedding class that implements embed_image(uris) (or subclass it and add the method).
  3. For image support independent of langchain, use a chromadb embedding function that natively supports images.

Example fix

# before
ef = create_langchain_embedding(OpenAIEmbeddings())  # text-only
vecs = ef(("images", ["file:///tmp/cat.png"]))  # ValueError: no image support

# after: custom class adding embed_image
class MyMultimodal(OpenAIEmbeddings):
    def embed_image(self, uris):
        return [self.client.images.embed(...) for u in uris]  # your model call

ef = create_langchain_embedding(MyMultimodal())
vecs = ef(("images", ["file:///tmp/cat.png"]))
Defensive patterns

Strategy: type-guard

Validate before calling

def can_embed_images(ef) -> bool:
    return hasattr(ef.embedding_function, "embed_image")

if not can_embed_images(ef):
    raise ValueError("Switch to a multimodal embedding function before ingesting images")

Type guard

from typing import Protocol

class SupportsImageEmbedding(Protocol):
    def embed_image(self, uris: list[str]) -> list[list[float]]: ...

def supports_image_embeddings(ef) -> bool:
    """True when the wrapped langchain function can embed images."""
    return hasattr(ef.embedding_function, "embed_image")

Try / catch

try:
    vecs = ef(("images", uris))
except ValueError as e:
    if "does not support image embeddings" in str(e):
        uris = None  # fall back to a text pipeline (captions/OCR) instead of failing
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/2bd8484f11c93217. Report an issue: GitHub.