microsoft/autogen · error · ValueError
Unsupported embedding function config type: {type(config)}
Error message
Unsupported embedding function config type: {type(config)} What it means
_create_embedding_function dispatches on the config type via isinstance checks against the known EmbeddingFunctionConfig subclasses; any config object outside that hierarchy falls through to the final else and raises ValueError naming the actual type.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/memory/chromadb/_chromadb.py:236
) from e
elif isinstance(config, OpenAIEmbeddingFunctionConfig):
try:
return embedding_functions.OpenAIEmbeddingFunction(api_key=config.api_key, model_name=config.model_name)
except Exception as e:
raise ImportError(
f"Failed to create OpenAI embedding function with model '{config.model_name}'. "
f"Ensure openai is installed and API key is valid. Error: {e}"
) from e
elif isinstance(config, CustomEmbeddingFunctionConfig):
try:
return config.function(**config.params)
except Exception as e:
raise ValueError(f"Failed to create custom embedding function. Error: {e}") from e
else:
raise ValueError(f"Unsupported embedding function config type: {type(config)}")
def _ensure_initialized(self) -> None:
"""Ensure ChromaDB client and collection are initialized."""
if self._client is None:
try:
from chromadb.config import Settings
settings = Settings(allow_reset=self._config.allow_reset)
if isinstance(self._config, PersistentChromaDBVectorMemoryConfig):
self._client = PersistentClient(
path=self._config.persistence_path,
settings=settings,
tenant=self._config.tenant,
database=self._config.database,
)
elif isinstance(self._config, HttpChromaDBVectorMemoryConfig):
self._client = HttpClient(View on GitHub (pinned to 027ecf0a37)
Solutions
- Use one of the exported config classes: DefaultEmbeddingFunctionConfig, SentenceTransformerEmbeddingFunctionConfig, OpenAIEmbeddingFunctionConfig, or CustomEmbeddingFunctionConfig.
- Ensure the config classes are imported from the same autogen_ext.memory.chromadb package/version as ChromaDBVectorMemory.
- Rebuild the component config from its documented schema (e.g. via ComponentBase config loading) instead of ad-hoc objects.
Example fix
# before
config.embedding_function_config = {"type": "default"}
# after
from autogen_ext.memory.chromadb import DefaultEmbeddingFunctionConfig
config.embedding_function_config = DefaultEmbeddingFunctionConfig() Defensive patterns
Strategy: type-guard
Validate before calling
from autogen_ext.memory.chromadb import (
DefaultEmbeddingFunctionConfig,
SentenceTransformerEmbeddingFunctionConfig,
OpenAIEmbeddingFunctionConfig,
CustomEmbeddingFunctionConfig,
)
ALLOWED = (DefaultEmbeddingFunctionConfig, SentenceTransformerEmbeddingFunctionConfig,
OpenAIEmbeddingFunctionConfig, CustomEmbeddingFunctionConfig)
assert isinstance(config.embedding_function_config, ALLOWED), "unknown embedding function config" Type guard
def is_supported_embedding_config(cfg) -> bool:
return isinstance(cfg, (
DefaultEmbeddingFunctionConfig,
SentenceTransformerEmbeddingFunctionConfig,
OpenAIEmbeddingFunctionConfig,
CustomEmbeddingFunctionConfig,
)) Prevention
- Construct configs only from the exported classes in autogen_ext.memory.chromadb.
- Import config classes and the memory class from the same autogen-ext version.
When it happens
Trigger: Passing a hand-rolled config class (or a plain dict, or a config from a different autogen version) as embedding_function_config in ChromaDBVectorMemoryConfig, then initializing the memory.
Common situations: Copy/pasting a config dataclass from an older/newer autogen-ext version so isinstance checks fail; constructing the config dict manually instead of via the exported config classes; version drift between config classes and the memory implementation.
Related errors
- Unsupported config type: {type(self._config)}
- Failed to create custom embedding function. Error: {e}
- Please set OPENAI_API_KEY environment variable.
- Please set OPENAI_API_KEY environment variable.
- BING_API_KEY environment variable is not set
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/5e2f8c1d0bfddfe3.
Report an issue: GitHub.