chroma-core/chroma · error · NotImplementedError
Building a ChromaLangchainEmbeddingFunction from config is n
Error message
Building a ChromaLangchainEmbeddingFunction from config is not supported. Please recreate the langchain embedding function and pass it to create_langchain_embedding.
What it means
build_from_config for the langchain bridge always raises NotImplementedError by design: arbitrary langchain embedding objects cannot be serialized (get_config only stores the class name and a placeholder note). When Chroma tries to rehydrate the EF from persisted config — typically when reopening a collection without supplying the function — this error tells you to reconstruct it manually.
Source
Thrown at chromadb/utils/embedding_functions/chroma_langchain_embedding_function.py:141
else:
# Cast to Sequence[str] to satisfy the type checker
embeddings = self.embed_documents(cast(Sequence[str], input))
# Convert to numpy arrays
return [np.array(embedding, dtype=np.float32) for embedding in embeddings]
@staticmethod
def name() -> str:
return "langchain"
@staticmethod
def build_from_config(
config: Dict[str, Any]
) -> "EmbeddingFunction[Union[Documents, Images]]":
# This is a placeholder implementation since we can't easily serialize and deserialize
# langchain embedding functions. Users will need to recreate the langchain embedding function
# and pass it to create_langchain_embedding.
raise NotImplementedError(
"Building a ChromaLangchainEmbeddingFunction from config is not supported. "
"Please recreate the langchain embedding function and pass it to create_langchain_embedding."
)
def get_config(self) -> Dict[str, Any]:
return {
"embedding_function_class": self._embedding_function_class,
"note": "This is a placeholder config. You will need to recreate the langchain embedding function.",
}
def validate_config_update(
self, old_config: Dict[str, Any], new_config: Dict[str, Any]
) -> None:
raise NotImplementedError(
"Updating a ChromaLangchainEmbeddingFunction config is not supported. "
"Please recreate the langchain embedding function and pass it to create_langchain_embedding."
)
View on GitHub (pinned to aecdd12c8a)
Solutions
- Recreate the langchain embedding at startup and pass it explicitly when reopening: get_collection(name, embedding_function=create_langchain_embedding(OpenAIEmbeddings(...))).
- Cache/construct the wrapped langchain object once at boot and reuse it for every get_collection call.
- If you need config-only persistence, switch to a native chromadb embedding function that supports build_from_config.
Example fix
# before (second process run)
col = client.get_collection("docs") # tries build_from_config -> NotImplementedError
# after (every run)
from langchain_openai import OpenAIEmbeddings
from chromadb.utils.embedding_functions import create_langchain_embedding
col = client.get_collection(
"docs",
embedding_function=create_langchain_embedding(OpenAIEmbeddings(model="text-embedding-3-large")),
) Defensive patterns
Strategy: fallback
Validate before calling
def get_collection_with_langchain_ef(client, name: str):
from langchain_openai import OpenAIEmbeddings
return client.get_collection(
name,
embedding_function=create_langchain_embedding(OpenAIEmbeddings(model="text-embedding-3-large")),
) # always supply the EF: langchain configs cannot be rebuilt Try / catch
try:
col = client.get_collection("docs") # no EF supplied
except NotImplementedError as e:
if "not supported" in str(e):
col = client.get_collection(
"docs",
embedding_function=create_langchain_embedding(build_my_langchain_ef()),
)
else:
raise Prevention
- Construct the langchain embedding once per process and pass it on every get_collection call.
- Never rely on persisted EF config for the langchain bridge — it stores only a class-name placeholder.
- If you need fully serializable functions, prefer native chromadb embedding functions.
When it happens
Trigger: A collection was created with a ChromaLangchainEmbeddingFunction (its persisted name is 'langchain'); later, get_collection is called without embedding_function= (or the system calls build_from_config on the stored config), triggering the unconditional raise.
Common situations: Process restart: app creates collection in run 1, then re-opens it in run 2 without re-passing the EF; server-side rehydration of collections whose EF config name is 'langchain'; teammates assuming the wrapper round-trips like native chromadb functions.
Related errors
- Updating a ChromaLangchainEmbeddingFunction config is not su
- Embedding function name not found in config: {ef_config}
- Could not build embedding function {ef_config['name']} from
- model must be provided in config
- The langchain_core python package is not installed. Please i
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/cc16ac74490c77e1.
Report an issue: GitHub.