{"record":{"id":"7bc5e1d2cab4d918","repo":"deepset-ai/haystack","slug":"you-must-provide-azure-endpoint-or-set-the-azur","errorCode":null,"errorMessage":"You must provide `azure_endpoint` or set the `AZURE_OPENAI_ENDPOINT` environment variable.","messagePattern":"You must provide `azure_endpoint` or set the `AZURE_OPENAI_ENDPOINT` environment variable\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"haystack/components/generators/chat/azure_responses.py","lineNumber":167,"sourceCode":"                    For detailed information on JSON mode, see the [OpenAI Structured Outputs documentation](https://platform.openai.com/docs/guides/structured-outputs#json-mode).\n            - `reasoning`: A dictionary of parameters for reasoning. For example:\n                - `summary`: The summary of the reasoning.\n                - `effort`: The level of effort to put into the reasoning. Can be `low`, `medium` or `high`.\n                - `generate_summary`: Whether to generate a summary of the reasoning.\n                Note: OpenAI does not return the reasoning tokens, but we can view summary if its enabled.\n                For details, see the [OpenAI Reasoning documentation](https://platform.openai.com/docs/guides/reasoning).\n        :param tools:\n            A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.\n        :param tools_strict:\n            Whether to enable strict schema adherence for tool calls. If set to `True`, the model will follow exactly\n            the schema provided in the `parameters` field of the tool definition, but this may increase latency.\n        :param http_client_kwargs:\n            A dictionary of keyword arguments to configure a custom `httpx.Client`or `httpx.AsyncClient`.\n            For more information, see the [HTTPX documentation](https://www.python-httpx.org/api/#client).\n        \"\"\"\n        azure_endpoint = azure_endpoint or os.getenv(\"AZURE_OPENAI_ENDPOINT\")\n        if azure_endpoint is None:\n            raise ValueError(\n                \"You must provide `azure_endpoint` or set the `AZURE_OPENAI_ENDPOINT` environment variable.\"\n            )\n        self._azure_endpoint = azure_endpoint\n        self._azure_deployment = azure_deployment\n        super(AzureOpenAIResponsesChatGenerator, self).__init__(  # noqa: UP008\n            api_key=api_key,  # type: ignore[arg-type]\n            model=self._azure_deployment,\n            streaming_callback=streaming_callback,\n            api_base_url=f\"{self._azure_endpoint.rstrip('/')}/openai/v1\",\n            organization=organization,\n            generation_kwargs=generation_kwargs,\n            timeout=timeout,\n            max_retries=max_retries,\n            tools=tools,\n            tools_strict=tools_strict,\n            http_client_kwargs=http_client_kwargs,\n        )\n","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/components/generators/chat/azure_responses.py#L149-L185","documentation":"AzureOpenAIResponsesChatGenerator requires an Azure OpenAI service endpoint URL to construct its client. The library raises this ValueError when neither the `azure_endpoint` parameter nor the `AZURE_OPENAI_ENDPOINT` environment variable provides one, because without it no API base URL exists.","triggerScenarios":"Instantiating `AzureOpenAIResponsesChatGenerator(...)` with `azure_endpoint=None` (the default) while the `AZURE_OPENAI_ENDPOINT` env var is unset or empty.","commonSituations":"Deploying to an environment (CI, containers, serverless) where the .env file is not loaded; renaming the env var or using the wrong name (e.g. AZURE_OPENAI_BASE); forgetting to pass azure_endpoint in YAML pipeline config.","solutions":["Set the AZURE_OPENAI_ENDPOINT environment variable to your Azure OpenAI resource URL (e.g. https://<resource>.openai.azure.com/)","Pass azure_endpoint='https://<resource>.openai.azure.com/' explicitly to the constructor","If using YAML, load the endpoint with env_var: ${AZURE_OPENAI_ENDPOINT} in the component init parameters","Verify the env var is actually exported/loaded in the runtime environment (print os.environ before init)"],"exampleFix":"// before\ngen = AzureOpenAIResponsesChatGenerator()\n// after\ngen = AzureOpenAIResponsesChatGenerator(azure_endpoint=\"https://my-resource.openai.azure.com/\", azure_deployment=\"gpt-4o\")","handlingStrategy":"validation","validationCode":"import os\nendpoint = azure_endpoint or os.getenv(\"AZURE_OPENAI_ENDPOINT\")\nif not endpoint:\n    raise SystemExit(\"Set AZURE_OPENAI_ENDPOINT (e.g. https://<resource>.openai.azure.com/) before init\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a loaded .env / secrets manager in every runtime (CI, containers)","Standardize the env var name AZURE_OPENAI_ENDPOINT across projects","Fail fast at pipeline startup with an explicit endpoint check"],"tags":["azure","openai","configuration","missing-endpoint","env-var"],"backgroundTag":"missing-env-var","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}