Python: Removed DefaultAzureCredential (#490)

* Removed DefaultAzureCredential

* Renamed ad_credential to credential
This commit is contained in:
Dmytro Struk
2025-08-26 08:33:17 -07:00
committed by GitHub
Unverified
parent 20d861076a
commit fa88641263
36 changed files with 230 additions and 148 deletions
@@ -120,7 +120,7 @@ class FoundryChatClient(ChatClientBase):
thread_id: str | None = None,
project_endpoint: str | None = None,
model_deployment_name: str | None = None,
async_ad_credential: AsyncTokenCredential | None = None,
async_credential: AsyncTokenCredential | None = None,
env_file_path: str | None = None,
env_file_encoding: str | None = None,
**kwargs: Any,
@@ -137,7 +137,7 @@ class FoundryChatClient(ChatClientBase):
conversation_id property, when making a request.
project_endpoint: The Azure AI Foundry project endpoint URL. Used if client is not provided.
model_deployment_name: The model deployment name to use for agent creation.
async_ad_credential: Azure async credential to use for authentication.
async_credential: Azure async credential to use for authentication.
env_file_path: Path to environment file for loading settings.
env_file_encoding: Encoding of the environment file.
**kwargs: Additional keyword arguments passed to the parent class.
@@ -162,15 +162,15 @@ class FoundryChatClient(ChatClientBase):
if agent_id is None and not foundry_settings.model_deployment_name:
raise ServiceInitializationError("Model deployment name is required for agent creation.")
# Use provided credential or fallback to DefaultAzureCredential
if not async_ad_credential:
# Use provided credential
if not async_credential:
raise ServiceInitializationError("Azure AD credential is required when client is not provided.")
client = AIProjectClient(endpoint=foundry_settings.project_endpoint, credential=async_ad_credential)
client = AIProjectClient(endpoint=foundry_settings.project_endpoint, credential=async_credential)
should_close_client = True
super().__init__(
client=client, # type: ignore[reportCallIssue]
credential=async_ad_credential, # type: ignore[reportCallIssue]
credential=async_credential, # type: ignore[reportCallIssue]
agent_id=agent_id, # type: ignore[reportCallIssue]
thread_id=thread_id, # type: ignore[reportCallIssue]
agent_name=foundry_settings.agent_name, # type: ignore[reportCallIssue]