fix: address CI lint failures and Bugbot review feedback

- Run ruff format on completion.py
- Remove unused 'import os' from test_azure_credentials.py
- Catch ImportError in _init_clients for deferred-build path
This commit is contained in:
Alex (CrewAI)
2026-04-15 06:30:05 -07:00
committed by Joao Moura
parent 31f480aac0
commit 04a2d606a3
3 changed files with 238 additions and 411 deletions

View File

@@ -118,8 +118,12 @@ class AzureCompletion(BaseLLM):
data["api_version"] = (
data.get("api_version") or os.getenv("AZURE_API_VERSION") or "2024-06-01"
)
data["azure_tenant_id"] = data.get("azure_tenant_id") or os.getenv("AZURE_TENANT_ID")
data["azure_client_id"] = data.get("azure_client_id") or os.getenv("AZURE_CLIENT_ID")
data["azure_tenant_id"] = data.get("azure_tenant_id") or os.getenv(
"AZURE_TENANT_ID"
)
data["azure_client_id"] = data.get("azure_client_id") or os.getenv(
"AZURE_CLIENT_ID"
)
# Credentials and endpoint are validated lazily in `_init_clients`
# so the LLM can be constructed before deployment env vars are set.
@@ -154,7 +158,7 @@ class AzureCompletion(BaseLLM):
try:
self._client = self._build_sync_client()
self._async_client = self._build_async_client()
except ValueError:
except (ValueError, ImportError):
pass
return self

View File

@@ -7,7 +7,6 @@ Covers the four credential paths:
4. AzureKeyCredential (API key - existing path)
"""
import os
from unittest.mock import patch, MagicMock
import pytest

638
uv.lock generated

File diff suppressed because it is too large Load Diff