{"record":{"id":"1e91545ac5e2cea1","repo":"microsoft/autogen","slug":"openai-endpoint-must-be-provided-for-azure-openai","errorCode":null,"errorMessage":"openai_endpoint must be provided for azure_openai embedding provider","messagePattern":"openai_endpoint must be provided for azure_openai embedding provider","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/tools/azure/_config.py","lineNumber":184,"sourceCode":"            raise ValueError(\"top must be a positive integer\")\n        return v\n\n    @model_validator(mode=\"after\")\n    def validate_interdependent_fields(self) -> \"AzureAISearchConfig\":\n        \"\"\"Validate interdependent fields after all fields have been parsed.\"\"\"\n        if self.query_type == \"semantic\" and not self.semantic_config_name:\n            raise ValueError(\"semantic_config_name must be provided when query_type is 'semantic'\")\n\n        if self.query_type == \"vector\" and not self.vector_fields:\n            raise ValueError(\"vector_fields must be provided for vector search\")\n\n        if (\n            self.embedding_provider\n            and self.embedding_provider.lower() == \"azure_openai\"\n            and self.embedding_model\n            and not self.openai_endpoint\n        ):\n            raise ValueError(\"openai_endpoint must be provided for azure_openai embedding provider\")\n\n        return self\n","sourceCodeStart":166,"sourceCodeEnd":187,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/tools/azure/_config.py#L166-L187","documentation":"Raised by the Azure tool config validator (model_validator in _config.py) when an Azure AI Search / indexing config declares embedding_provider='azure_openai' together with an embedding_model, but leaves openai_endpoint empty. The Azure OpenAI embedding client needs an explicit HTTPS endpoint to build the connection, so the config is rejected before any network call is made. It is a fail-fast configuration error, not a runtime service error.","triggerScenarios":"Building a search/index tool config with embedding_provider='azure_openai' and embedding_model set (e.g. 'text-embedding-ada-002') but omitting openai_endpoint. The validator fires on model validation (config creation / .model_validate), before tool construction completes.","commonSituations":"Copying an example config that only shows provider+model and skipping the endpoint; assuming the endpoint is read from an AZURE_OPENAI_ENDPOINT env var automatically; typos like 'openai_endpint' leaving the real field empty; switching provider from 'azure_search' managed embeddings to azure_openai without adding the endpoint field.","solutions":["Add openai_endpoint='https://<your-resource>.openai.azure.com/' to the same config object.","Verify the endpoint string is the full Azure OpenAI resource URL, not just the resource name.","If you do not want Azure OpenAI embeddings, set embedding_provider to the managed/Azure Search option and clear embedding_model so the azure_openai branch no longer applies.","Check for trailing-whitespace or empty-string values: the guard only tests truthiness, so an empty string also triggers it."],"exampleFix":"# before\ncfg = AzureSearchConfig(\n    embedding_provider=\"azure_openai\",\n    embedding_model=\"text-embedding-ada-002\",\n)\n\n# after\ncfg = AzureSearchConfig(\n    embedding_provider=\"azure_openai\",\n    embedding_model=\"text-embedding-ada-002\",\n    openai_endpoint=\"https://my-resource.openai.azure.com/\",\n)","handlingStrategy":"validation","validationCode":"required = (\n    cfg.embedding_provider\n    and cfg.embedding_provider.lower() == \"azure_openai\"\n    and cfg.embedding_model\n)\nif required and not cfg.openai_endpoint:\n    raise ValueError(\"set openai_endpoint before building the azure tool\")","typeGuard":"def azure_embedding_config_is_complete(cfg: AzureConfig) -> bool:\n    if cfg.embedding_provider and cfg.embedding_provider.lower() == \"azure_openai\" and cfg.embedding_model:\n        return bool(cfg.openai_endpoint)\n    return True","tryCatchPattern":"try:\n    cfg = AzureConfig(**raw)\nexcept ValueError as e:\n    # fail fast with a user-facing config error\n    raise ConfigError(str(e)) from e","preventionTips":["Validate config objects at load time in one place, not at tool construction time.","Keep a schema/JSON template for the azure config that includes openai_endpoint as a required-looking field for azure_openai providers.","Add a unit test that constructs the config with azure_openai provider to catch regressions."],"tags":["azure","config","validation","embedding","pydantic"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}