o
    +il                     @  sT   d dl mZ d dlmZmZmZ ddlmZ erd dlm	Z	 dd
dZ
dddZdS )    )annotations)TYPE_CHECKINGAnycast   )google_auth)Credentials
project_id
str | Nonereturntuple[Credentials, str]c              
   C  s   zddl m} W n ty } ztd|d }~ww tjdgd\}}tt|}||  | s2|} | s8t	dt
| tsFtdt|  || fS )Nr   Requestz^Could not import google.auth, you need to install the SDK with `pip install anthropic[vertex]`z.https://www.googleapis.com/auth/cloud-platform)scopeszCould not resolve project_idz(Expected project_id to be a str but got )google.auth.transport.requestsr   ModuleNotFoundErrorRuntimeErrorr   defaultr   r   refresh
ValueError
isinstancestr	TypeErrortype)r	   r   errcredentialsloaded_project_id r   W/var/www/html/psymed-ai/venv/lib/python3.10/site-packages/anthropic/lib/vertex/_auth.py	load_auth   s,   


r   r   r   Nonec                 C  s   ddl m} | |  d S )Nr   r   )r   r   r   )r   r   r   r   r   refresh_auth,   s   r!   N)r	   r
   r   r   )r   r   r   r    )
__future__r   typingr   r   r   _extrasr   google.auth.credentialsr   r   r!   r   r   r   r   <module>   s    

