diff --git a/sdk/evaluation/azure-ai-evaluation/CHANGELOG.md b/sdk/evaluation/azure-ai-evaluation/CHANGELOG.md index e367e15a301d..176d0e65ff5e 100644 --- a/sdk/evaluation/azure-ai-evaluation/CHANGELOG.md +++ b/sdk/evaluation/azure-ai-evaluation/CHANGELOG.md @@ -9,6 +9,7 @@ ### Bugs Fixed - Output of adversarial simulators are of type `JsonLineList` and the helper function `to_eval_qr_json_lines` now outputs context from both user and assistant turns along with `category` if it exists in the conversation +- Fixed an issue where during long-running simulations, API token expires causing "Forbidden" error. Instead, users can now set an environment variable `AZURE_TOKEN_REFRESH_INTERVAL` to refresh the token more frequently to prevent expiration and ensure continuous operation of the simulation. ### Other Changes - Refined error messages for serviced-based evaluators and simulators. diff --git a/sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/simulator/_model_tools/_identity_manager.py b/sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/simulator/_model_tools/_identity_manager.py index 041517ee5acd..166e94924023 100644 --- a/sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/simulator/_model_tools/_identity_manager.py +++ b/sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/simulator/_model_tools/_identity_manager.py @@ -14,7 +14,9 @@ from azure.core.credentials import AccessToken, TokenCredential from azure.identity import DefaultAzureCredential, ManagedIdentityCredential -AZURE_TOKEN_REFRESH_INTERVAL = 600 # seconds +AZURE_TOKEN_REFRESH_INTERVAL = int( + os.getenv("AZURE_TOKEN_REFRESH_INTERVAL", "600") +) # token refresh interval in seconds class TokenScope(Enum):