
    h                     8    d dl mZmZmZ ddlmZ  G d d      Zy)    )OptionalDictAny   )
HTTPClientc                   T    e Zd ZdZd
dedee   defdZdeee	f   fdZ
dee   fd	Zy)HealthManagementClientzW
    Client for interacting with the health endpoints of the LiteLLM proxy server.
    Nbase_urlapi_keytimeoutc                 *    t        |||      | _        y)aa  
        Initialize the HealthManagementClient.

        Args:
            base_url (str): The base URL of the LiteLLM proxy server (e.g., "http://localhost:4000")
            api_key (Optional[str]): API key for authentication. If provided, it will be sent as a Bearer token.
            timeout (int): Request timeout in seconds (default: 30)
        )r
   r   r   N)r   _http)selfr
   r   r   s       W/var/www/Befach/backend/env/lib/python3.12/site-packages/litellm/proxy/client/health.py__init__zHealthManagementClient.__init__   s      7GT
    returnc                 :    | j                   j                  dd      S )a4  
        Check the readiness of the LiteLLM proxy server.

        Returns:
            Dict[str, Any]: The readiness status and details from the server.

        Raises:
            requests.exceptions.RequestException: If the request fails
            ValueError: If the response is not valid JSON
        GETz/health/readiness)r   request)r   s    r   get_readinessz$HealthManagementClient.get_readiness   s     zz!!%)<==r   c                 D    | j                         }|j                  d      S )z
        Get the LiteLLM server version from the readiness endpoint.

        Returns:
            Optional[str]: The server version if available, otherwise None.
        litellm_version)r   get)r   	readinesss     r   get_server_versionz)HealthManagementClient.get_server_version    s"     &&(	}}.//r   )N   )__name__
__module____qualname____doc__strr   intr   r   r   r   r    r   r   r	   r	      sM    	U 	Ux} 	Uc 	U>tCH~ >0HSM 0r   r	   N)typingr   r   r   http_clientr   r	   r$   r   r   <module>r'      s    & & #$0 $0r   