{"record":{"id":"d687e2b2a9cfc3b3","repo":"microsoft/autogen","slug":"host-class-must-have-a-search-config-attribute","errorCode":null,"errorMessage":"Host class must have a search_config attribute","messagePattern":"Host class must have a search_config attribute","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/tools/azure/_ai_search.py","lineNumber":141,"sourceCode":"\n\nclass EmbeddingProvider(Protocol):\n    \"\"\"Protocol defining the interface for embedding generation.\"\"\"\n\n    async def _get_embedding(self, query: str) -> List[float]:\n        \"\"\"Generate embedding vector for the query text.\"\"\"\n        ...\n\n\nclass EmbeddingProviderMixin:\n    \"\"\"Mixin class providing embedding generation functionality.\"\"\"\n\n    search_config: AzureAISearchConfig\n\n    async def _get_embedding(self, query: str) -> List[float]:\n        \"\"\"Generate embedding vector for the query text.\"\"\"\n        if not hasattr(self, \"search_config\"):\n            raise ValueError(\"Host class must have a search_config attribute\")\n\n        search_config = self.search_config\n        embedding_provider = getattr(search_config, \"embedding_provider\", None)\n        embedding_model = getattr(search_config, \"embedding_model\", None)\n\n        if not embedding_provider or not embedding_model:\n            raise ValueError(\n                \"Client-side embedding is not configured. `embedding_provider` and `embedding_model` must be set.\"\n            ) from None\n\n        if embedding_provider.lower() == \"azure_openai\":\n            try:\n                from openai import AsyncAzureOpenAI\n\n                from azure.identity import DefaultAzureCredential\n            except ImportError:\n                raise ImportError(\n                    \"Azure OpenAI SDK is required for client-side embedding generation. \"","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/tools/azure/_ai_search.py#L123-L159","documentation":"Error \"Host class must have a search_config attribute\" thrown in microsoft/autogen.","triggerScenarios":"Thrown at python/packages/autogen-ext/src/autogen_ext/tools/azure/_ai_search.py:141 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Define search_config on the subclass"],"exampleFix":"Set self.search_config = SearchConfig(...) in __init__","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}