@@ -239,6 +239,7 @@ def get_complete_vertex_url(
239
239
stream = stream ,
240
240
auth_header = None ,
241
241
url = default_api_base ,
242
+ model = model ,
242
243
)
243
244
return api_base
244
245
@@ -387,31 +388,31 @@ def _handle_reauthentication(
387
388
) -> Tuple [str , str ]:
388
389
"""
389
390
Handle reauthentication when credentials refresh fails.
390
-
391
+
391
392
This method clears the cached credentials and attempts to reload them once.
392
393
It should only be called when "Reauthentication is needed" error occurs.
393
-
394
+
394
395
Args:
395
396
credentials: The original credentials
396
397
project_id: The project ID
397
398
credential_cache_key: The cache key to clear
398
399
error: The original error that triggered reauthentication
399
-
400
+
400
401
Returns:
401
402
Tuple of (access_token, project_id)
402
-
403
+
403
404
Raises:
404
405
The original error if reauthentication fails
405
406
"""
406
407
verbose_logger .debug (
407
408
f"Handling reauthentication for project_id: { project_id } . "
408
409
f"Clearing cache and retrying once."
409
410
)
410
-
411
+
411
412
# Clear the cached credentials
412
413
if credential_cache_key in self ._credentials_project_mapping :
413
414
del self ._credentials_project_mapping [credential_cache_key ]
414
-
415
+
415
416
# Retry once with _retry_reauth=True to prevent infinite recursion
416
417
try :
417
418
return self .get_access_token (
@@ -441,12 +442,12 @@ def get_access_token(
441
442
3. Check if loaded credentials have expired
442
443
4. If expired, refresh credentials
443
444
5. Return access token and project id
444
-
445
+
445
446
Args:
446
447
credentials: The credentials to use for authentication
447
448
project_id: The Google Cloud project ID
448
449
_retry_reauth: Internal flag to prevent infinite recursion during reauthentication
449
-
450
+
450
451
Returns:
451
452
Tuple of (access_token, project_id)
452
453
"""
0 commit comments