Skip to content

Commit 0c191b0

Browse files
committed
Fixed rlsapi token refresh + CI config
1 parent daf6dd3 commit 0c191b0

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/app/endpoints/rlsapi_v1.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import constants
2121
from authentication import get_auth_dependency
2222
from authentication.interface import AuthTuple
23+
from authorization.azure_token_manager import AzureEntraIDManager
2324
from authorization.middleware import authorize
2425
from client import AsyncLlamaStackClientHolder
2526
from configuration import configuration
@@ -327,6 +328,16 @@ async def _call_llm(
327328
"""
328329
client = AsyncLlamaStackClientHolder().get_client()
329330
resolved_model_id = model_id or await _get_default_model_id()
331+
332+
# Handle Azure token refresh if needed
333+
if (
334+
resolved_model_id.startswith("azure")
335+
and AzureEntraIDManager().is_entra_id_configured
336+
and AzureEntraIDManager().is_token_expired
337+
and AzureEntraIDManager().refresh_token()
338+
):
339+
client = await AsyncLlamaStackClientHolder().update_azure_token()
340+
330341
logger.debug("Using model %s for rlsapi v1 inference", resolved_model_id)
331342

332343
response = await client.responses.create(

tests/e2e/configs/run-azure.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ providers:
2222
- provider_id: azure
2323
provider_type: remote::azure
2424
config:
25-
api_key: ${env.AZURE_API_KEY}
2625
base_url: https://ols-test.openai.azure.com/openai/v1
2726
api_version: 2024-02-15-preview
2827
allowed_models: ["gpt-4o-mini"]
28+
model_validation: false
2929
- provider_id: openai
3030
provider_type: remote::openai
3131
config:

0 commit comments

Comments
 (0)