mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: Improved exception messages in client initialization (#539)
* Improved exception messages in client initialization * Fixed tests
This commit is contained in:
committed by
GitHub
Unverified
parent
f5043e4fc1
commit
0c28935382
@@ -157,14 +157,20 @@ class FoundryChatClient(ChatClientBase):
|
||||
should_close_client = False
|
||||
if client is None:
|
||||
if not foundry_settings.project_endpoint:
|
||||
raise ServiceInitializationError("Project endpoint is required when client is not provided.")
|
||||
raise ServiceInitializationError(
|
||||
"Foundry project endpoint is required. Set via 'project_endpoint' parameter "
|
||||
"or 'FOUNDRY_PROJECT_ENDPOINT' environment variable."
|
||||
)
|
||||
|
||||
if agent_id is None and not foundry_settings.model_deployment_name:
|
||||
raise ServiceInitializationError("Model deployment name is required for agent creation.")
|
||||
raise ServiceInitializationError(
|
||||
"Foundry model deployment name is required. Set via 'model_deployment_name' parameter "
|
||||
"or 'FOUNDRY_MODEL_DEPLOYMENT_NAME' environment variable."
|
||||
)
|
||||
|
||||
# Use provided credential
|
||||
if not async_credential:
|
||||
raise ServiceInitializationError("Azure AD credential is required when client is not provided.")
|
||||
raise ServiceInitializationError("Azure credential is required when client is not provided.")
|
||||
client = AIProjectClient(endpoint=foundry_settings.project_endpoint, credential=async_credential)
|
||||
should_close_client = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user