From c6240ff621f1a53e837fe2bb57dbabf97da4a812 Mon Sep 17 00:00:00 2001 From: Chesars Date: Thu, 19 Feb 2026 15:14:09 -0300 Subject: [PATCH] fix(azure_ai): resolve api_base from env var in get_complete_url for Document Intelligence OCR validate_environment() resolved AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT from the env var but only returned headers. get_complete_url() still received None and raised ValueError. Now get_complete_url() also resolves the env var as a fallback. Fixes #21034 --- .../llms/azure_ai/ocr/document_intelligence/transformation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/litellm/llms/azure_ai/ocr/document_intelligence/transformation.py b/litellm/llms/azure_ai/ocr/document_intelligence/transformation.py index b1ccfc36d0d..f6c6da24098 100644 --- a/litellm/llms/azure_ai/ocr/document_intelligence/transformation.py +++ b/litellm/llms/azure_ai/ocr/document_intelligence/transformation.py @@ -121,6 +121,9 @@ class AzureDocumentIntelligenceOCRConfig(BaseOCRConfig): Returns: Complete URL for Azure DI analyze endpoint """ + if api_base is None: + api_base = get_secret_str("AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT") + if api_base is None: raise ValueError( "Missing Azure Document Intelligence Endpoint - Set AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT environment variable or pass api_base parameter"