
    g	                     l    d dl Z d dlZddlmZ ddlmZ  G d d      Z G d de      Z G d	 d
e      Zy)    N   )
HttpClient)AsyncHttpClientc            
          e Zd Zddddej                  e   dej                  eej                  g ef   f   dedej                  e   fdZ	dej                  eef   fd	Zdefd
ZdefdZdej                  e   fdZy)BaseClientWrapperNclient_nametimeoutr	   tokenbase_urlr
   c                <    || _         || _        || _        || _        y N)_client_name_token	_base_url_timeout)selfr	   r   r   r
   s        O/var/www/openai/venv/lib/python3.12/site-packages/cohere/core/client_wrapper.py__init__zBaseClientWrapper.__init__
   s!     (!    returnc                 t    dddd}| j                   | j                   |d<   d| j                          |d<   |S )NPythoncoherez5.13.12)zX-Fern-LanguagezX-Fern-SDK-NamezX-Fern-SDK-VersionzX-Client-NamezBearer Authorization)r   
_get_token)r   headerss     r   get_headerszBaseClientWrapper.get_headers   sN    ''"+*

 ('+'8'8GO$%,T__->,?#@ r   c                 n    t        | j                  t              r| j                  S | j                         S r   )
isinstancer   strr   s    r   r   zBaseClientWrapper._get_token"   s&    dkk3';;;;= r   c                     | j                   S r   )r   r"   s    r   get_base_urlzBaseClientWrapper.get_base_url(   s    ~~r   c                     | j                   S r   )r   r"   s    r   get_timeoutzBaseClientWrapper.get_timeout+   s    }}r   )__name__
__module____qualname__typingOptionalr!   UnionCallablefloatr   Dictr   r   r$   r&    r   r   r   r   	   s     -1 +/  __S)  ||CS!99:	 
   ' 	V[[c2 	!C !c V__U3 r   r   c                        e Zd Zddddej                  e   dej                  eej                  g ef   f   dedej                  e   de	j                  f
 fdZ xZS )	SyncClientWrapperNr   r	   r   r   r
   httpx_clientc                    t         |   ||||       t        || j                  | j                  | j
                        | _        y N)r	   r   r   r
   )r3   base_headersbase_timeoutr   )superr   r   r   r&   r$   r3   r   r	   r   r   r
   r3   	__class__s         r   r   zSyncClientWrapper.__init__0   sG     	[Zab&%))))&&	
r   )r'   r(   r)   r*   r+   r!   r,   r-   r.   httpxClientr   __classcell__r:   s   @r   r2   r2   /   sz     -1 +/
 __S)
 ||CS!99:	

 
 '
 ll
 
r   r2   c                        e Zd Zddddej                  e   dej                  eej                  g ef   f   dedej                  e   de	j                  f
 fdZ xZS )	AsyncClientWrapperNr   r	   r   r   r
   r3   c                    t         |   ||||       t        || j                  | j                  | j
                        | _        y r5   )r8   r   r   r   r&   r$   r3   r9   s         r   r   zAsyncClientWrapper.__init__C   sG     	[Zab+%))))&&	
r   )r'   r(   r)   r*   r+   r!   r,   r-   r.   r;   AsyncClientr   r=   r>   s   @r   r@   r@   B   s|     -1 +/
 __S)
 ||CS!99:	

 
 '
 ''
 
r   r@   )r*   r;   http_clientr   r   r   r2   r@   r0   r   r   <module>rD      s8      # (# #L
) 
&
* 
r   