Skip to content

Commit

Permalink
[Evaluation] add environment variable for API token refresh rate (#38162
Browse files Browse the repository at this point in the history
)

* 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
  • Loading branch information
slister1001 authored Oct 31, 2024
1 parent 946fe58 commit 3df9e23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions sdk/evaluation/azure-ai-evaluation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 3df9e23

Please sign in to comment.