{"record":{"id":"5e2f8c1d0bfddfe3","repo":"microsoft/autogen","slug":"unsupported-embedding-function-config-type-type","errorCode":null,"errorMessage":"Unsupported embedding function config type: {type(config)}","messagePattern":"Unsupported embedding function config type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/memory/chromadb/_chromadb.py","lineNumber":236,"sourceCode":"                ) from e\n\n        elif isinstance(config, OpenAIEmbeddingFunctionConfig):\n            try:\n                return embedding_functions.OpenAIEmbeddingFunction(api_key=config.api_key, model_name=config.model_name)\n            except Exception as e:\n                raise ImportError(\n                    f\"Failed to create OpenAI embedding function with model '{config.model_name}'. \"\n                    f\"Ensure openai is installed and API key is valid. Error: {e}\"\n                ) from e\n\n        elif isinstance(config, CustomEmbeddingFunctionConfig):\n            try:\n                return config.function(**config.params)\n            except Exception as e:\n                raise ValueError(f\"Failed to create custom embedding function. Error: {e}\") from e\n\n        else:\n            raise ValueError(f\"Unsupported embedding function config type: {type(config)}\")\n\n    def _ensure_initialized(self) -> None:\n        \"\"\"Ensure ChromaDB client and collection are initialized.\"\"\"\n        if self._client is None:\n            try:\n                from chromadb.config import Settings\n\n                settings = Settings(allow_reset=self._config.allow_reset)\n\n                if isinstance(self._config, PersistentChromaDBVectorMemoryConfig):\n                    self._client = PersistentClient(\n                        path=self._config.persistence_path,\n                        settings=settings,\n                        tenant=self._config.tenant,\n                        database=self._config.database,\n                    )\n                elif isinstance(self._config, HttpChromaDBVectorMemoryConfig):\n                    self._client = HttpClient(","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/memory/chromadb/_chromadb.py#L218-L254","documentation":"_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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nconfig.embedding_function_config = {\"type\": \"default\"}\n# after\nfrom autogen_ext.memory.chromadb import DefaultEmbeddingFunctionConfig\nconfig.embedding_function_config = DefaultEmbeddingFunctionConfig()","handlingStrategy":"type-guard","validationCode":"from autogen_ext.memory.chromadb import (\n    DefaultEmbeddingFunctionConfig,\n    SentenceTransformerEmbeddingFunctionConfig,\n    OpenAIEmbeddingFunctionConfig,\n    CustomEmbeddingFunctionConfig,\n)\nALLOWED = (DefaultEmbeddingFunctionConfig, SentenceTransformerEmbeddingFunctionConfig,\n           OpenAIEmbeddingFunctionConfig, CustomEmbeddingFunctionConfig)\nassert isinstance(config.embedding_function_config, ALLOWED), \"unknown embedding function config\"","typeGuard":"def is_supported_embedding_config(cfg) -> bool:\n    return isinstance(cfg, (\n        DefaultEmbeddingFunctionConfig,\n        SentenceTransformerEmbeddingFunctionConfig,\n        OpenAIEmbeddingFunctionConfig,\n        CustomEmbeddingFunctionConfig,\n    ))","tryCatchPattern":null,"preventionTips":["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."],"tags":["autogen","chromadb","configuration","type-validation"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}