Ë
    tPêj  ã                   ó4   — d Z ddlmZmZ ddlZ G d„ d«      Zy)ú<HTTP client for making requests to the LiteLLM proxy server.é    )ÚAnyÚFinalNc                   óœ   — e Zd ZdZddededz  defd„Zddddœded	ed
eeef   e	z  e
z  dz  deeef   e	z  dz  deeef   dz  dedefd„Zy)Ú
HTTPClientr   NÚbase_urlÚapi_keyÚtimeoutc                 óL   — |j                  d«      | _        || _        || _        y)zåInitialize the HTTP client.

        Args:
            base_url: Base URL of the LiteLLM proxy server
            api_key: Optional API key for authentication
            timeout: Request timeout in seconds (default: 30)
        ú/N)ÚrstripÚ	_base_urlÚ_api_keyÚ_timeout)Úselfr   r	   r
   s       úe/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/litellm/proxy/client/http_client.pyÚ__init__zHTTPClient.__init__   s"   € ð "Ÿ™¨Ó-ˆŒØˆŒØˆ�ó    )ÚdataÚjsonÚheadersÚmethodÚurir   r   r   ÚkwargsÚreturnc          
      ó4  — | j                   › d|j                  d«      › �}i }|r|j                  |«       | j                  rd| j                  › �|d<   t	        j
                  d|||||| j                  dœ|¤Ž}	|	j                  «        |	j                  «       S )a®  Make an HTTP request to the LiteLLM proxy server.

        This method is used to make generic requests to the LiteLLM proxy
        server, when there is not a specific client or method for the request.

        Args:
            method: HTTP method (GET, POST, PUT, DELETE, etc.)
            uri: URI path (will be appended to base_url) (e.g., "/credentials")
            data: (optional) Dictionary, list of tuples, bytes, or file-like
                object to send in the body of the request.
            json: (optional) A JSON serializable Python object to send in the body
                of the request.
            headers: (optional) Dictionary of HTTP headers to send with the request.
            **kwargs: Additional keyword arguments to pass to the request.

        Returns:
            Parsed JSON response from the server

        Raises:
            requests.exceptions.RequestException: If the request fails
            ValueError: If the response is not valid JSON

        Example:
            >>> client.http.request("POST", "/health/test_connection", json={
                "litellm_params": {
                    "model": "gpt-4",
                    "custom_llm_provider": "azure_ai",
                    "litellm_credential_name": None,
                    "api_key": "6xxxxxxx",
                    "api_base": "https://litellm8397336933.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21",
                },
                "mode": "chat",
            })
            {'status': 'error',
             'result': {'model': 'gpt-4',
             'custom_llm_provider': 'azure_ai',
             'litellm_credential_name': None,
             ...
        r   zBearer ÚAuthorization)r   Úurlr   r   r   r
   © )	r   ÚlstripÚupdater   ÚrequestsÚrequestr   Úraise_for_statusr   )
r   r   r   r   r   r   r   r   Úrequest_headersÚresponses
             r   r#   zHTTPClient.request   s¨   € ðd Ÿ™Ð' q¨¯©°C«Ð(9Ð:ˆð "$ˆÙØ×"Ñ" 7Ô+Ø�=Š=Ø18¸¿¹¸Ð/HˆO˜OÑ,ä"×*Ñ*ð 
ØØØØØ#Ø—M‘Mñ
ð ñ
ˆð 	×!Ñ!Ô#ð �}‰}‹Ðr   )Né   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚstrÚintr   Údictr   ÚlistÚbytesr#   r   r   r   r   r      sµ   „ ÙFñ
  ð 
 ¨s°T©zð 
 È3ó 
 ð" 6:Ø-1Ø)-òIàðIð ðIð
 �3˜�8‰n˜tÑ# eÑ+¨dÑ2ðIð �3˜�8‰n˜tÑ# dÑ*ðIð �c˜3�h‘ $Ñ&ðIð ðIð 
ôIr   r   )r+   Útypingr   r   r"   r   r   r   r   ú<module>r2      s   ðÙ Bç ã ÷Xò Xr   