Skip to content

Commit 3df9e23

Browse files
authored
[Evaluation] add environment variable for API token refresh rate (#38162)
* use env var for azure token refresh interval * update changelog and set default value for env var * cast refresh rate to int * fix pylint error * fix tox black issue
1 parent 946fe58 commit 3df9e23

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

sdk/evaluation/azure-ai-evaluation/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
### Bugs Fixed
1111
- 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
12+
- 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.
1213

1314
### Other Changes
1415
- Refined error messages for serviced-based evaluators and simulators.

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/simulator/_model_tools/_identity_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
from azure.core.credentials import AccessToken, TokenCredential
1515
from azure.identity import DefaultAzureCredential, ManagedIdentityCredential
1616

17-
AZURE_TOKEN_REFRESH_INTERVAL = 600 # seconds
17+
AZURE_TOKEN_REFRESH_INTERVAL = int(
18+
os.getenv("AZURE_TOKEN_REFRESH_INTERVAL", "600")
19+
) # token refresh interval in seconds
1820

1921

2022
class TokenScope(Enum):

0 commit comments

Comments
 (0)