
    5P@i$                       d dl mZ d dlZd dlZd dlZd dlmZmZ d dlm	Z	 d dl
mc mZ d dlmZ d dlmZ d dlmZ d dlmZ 	 d d	lmZ ej0                  ZdZej6                   G d d             Zddddddd	 	 	 	 	 	 	 	 	 	 	 ddZ e       Zej;                          ddZddZ ddZ!ddZ"ddZ#ddZ$ddZ%y# e$ r d
ZY ow xY w)     )annotationsN)Anycast)Sequence)credentials)client_options)gapic_v1)operations_v1)versionz0.0.0zgenai-pyc                      e Zd ZU  ej                  e      Zded<   dZded<   dZ	ded	<   dZ
d
ed<    ej                  e      Zded<   ddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 ddZd Zd ZddZy)_ClientManager)default_factoryzdict[str, Any]client_config Sequence[tuple[str, str]]default_metadataNzglm.DiscussServiceClient | Nonediscuss_clientz$glm.DiscussServiceAsyncClient | Nonediscuss_async_clientclientsapi_keyr   	transportr   client_infor   c               n   t        |t              rt        j                  |      }|t        j                         }t        t        j                  |      }t        |dd      }|r|)t        d      |t        j                  d      }||_
        t         dt         }|r-|j                  r|xj                  d| z  c_        n(||_        n t        j                  j!                  |      }||||d}	|	j#                         D 
ci c]  \  }
}|	|
| }	}
}|	| _        || _        i | _        yc c}}
w )	a  Captures default client configuration.

        If no API key has been provided (either directly, or on `client_options`) and the
        `GOOGLE_API_KEY` environment variable is set, it will be used as the API key.

        Note: Not all arguments are detailed below. Refer to the `*ServiceClient` classes in
        `google.ai.generativelanguage` for details on the other arguments.

        Args:
            transport: A string, one of: [`rest`, `grpc`, `grpc_asyncio`].
            api_key: The API-Key to use when creating the default clients (each service uses
                a separate client). This is a shortcut for `client_options={"api_key": api_key}`.
                If omitted, and the `GOOGLE_API_KEY` environment variable is set, it will be
                used.
            default_metadata: Default (key, value) metadata pairs to send with every request.
                when using `transport="rest"` these are sent as HTTP headers.
        Nr   z=You can't set both `api_key` and `client_options['api_key']`.GOOGLE_API_KEY/ )
user_agent)r   r   r   r   )
isinstancedictclient_options_lib	from_dictClientOptionsr   getattr
ValueErrorosgetenvr   
USER_AGENT__version__r   r	   r   
ClientInfoitemsr   r   r   )selfr   r   r   r   r   r   had_api_key_valuer   r   keyvalues               d/home/www/lebenam.kofcorporation.com/venv/lib/python3.12/site-packages/google/generativeai/client.py	configurez_ClientManager.configure#   s;   B nd+/99.IN!/==?N0>>O#NItD" !`aa ))$45%,N""|1[M2
%%&&Aj\*::&)3&"..99Z9PK '",&	
 7D6I6I6Ka
UuO`eaa* 0 bs   
D1D1c                    |j                  d      r6|j                  d      d   }t        t        |j	                         dz         }n!t        t        |j	                         dz         } j
                  s
t                 |di  j
                  } j                  s|S d } fd}|j                  j                         D ]0  \  }} |||      st        ||      } ||      }t        |||       2 |S )	N_async_r   ServiceAsyncClientServiceClientc                    | j                  d      ryt        |t        j                        syt        |t              ryt        |t
              ryy)Nr4   FT)
startswithr   typesFunctionTypeclassmethodstaticmethod)namefs     r0   keepz(_ClientManager.make_client.<locals>.keep~   sA    s#5#5#56A{+A|,    c                     dd fd
}|S )Nr   )metadatac                ^    t        |       t        j                        z   }  |i |d| iS )NrB   )listr   )rB   argskwargsr>   r,   s      r0   callzN_ClientManager.make_client.<locals>.add_default_metadata_wrapper.<locals>.call   s1    >D1F1F,GG$<&<8<<r@   r   )r>   rG   r,   s   ` r0   add_default_metadata_wrapperz@_ClientManager.make_client.<locals>.add_default_metadata_wrapper   s    %' = Kr@   r   )endswithsplitr$   glmtitler   r1   r   __dict__r+   setattr)r,   r=   clsclientr?   rH   r/   r>   s   `       r0   make_clientz_ClientManager.make_clientn   s    =="::c?1%D#tzz|.BBCC#tzz|o=>C !!K*t))*$$M
		 <<--/ 	%KD%e$%A,Q/AFD!$	% r@   c                    |j                         }|dk(  r| j                         S | j                  j                  |      }| | j	                  |      }|| j                  |<   |S N
operations)lowerget_default_operations_clientr   getrQ   )r,   r=   rP   s      r0   get_default_clientz!_ClientManager.get_default_client   s`    zz|<5577!!$'>%%d+F!'DLLr@   c                    | j                   j                  dd       }|6| j                  d      }|j                  j                  }|| j                   d<   |S )NrT   Model)r   rW   rX   
_transportoperations_client)r,   rP   model_clients      r0   rV   z,_ClientManager.get_default_operations_client   sQ    !!,5>227;L!,,>>F)/DLL&r@   )r   
str | Noner   (ga_credentials.Credentials | dict | Noner   r^   r   z8client_options_lib.ClientOptions | dict[str, Any] | Noner   &gapic_v1.client_info.ClientInfo | Noner   r   returnNonera   zoperations_v1.OperationsClient)__name__
__module____qualname__dataclassesfieldr    r   __annotations__r   r   r   r   r1   rQ   rX   rV   r   r@   r0   r   r      s    $5K$5$5d$KM>K24/46:N3:AE>E/k//EG^E
 #@D !%SW>B68I I >	I I QI <I 4I 
IV*X	r@   r   r   r   c                8    t         j                  | |||||      S )a  Captures default client configuration.

    If no API key has been provided (either directly, or on `client_options`) and the
    `GOOGLE_API_KEY` environment variable is set, it will be used as the API key.

    Note: Not all arguments are detailed below. Refer to the `*ServiceClient` classes in
    `google.ai.generativelanguage` for details on the other arguments.

    Args:
        transport: A string, one of: [`rest`, `grpc`, `grpc_asyncio`].
        api_key: The API-Key to use when creating the default clients (each service uses
            a separate client). This is a shortcut for `client_options={"api_key": api_key}`.
            If omitted, and the `GOOGLE_API_KEY` environment variable is set, it will be
            used.
        default_metadata: Default (key, value) metadata pairs to send with every request.
            when using `transport="rest"` these are sent as HTTP headers.
    r   )_client_managerr1   r   s         r0   r1   r1      s/    @ $$%) %  r@   c                 ,    t         j                  d      S )Ndiscussrk   rX   r   r@   r0   get_default_discuss_clientro      s    --i88r@   c                 ,    t         j                  d      S )Ndiscuss_asyncrn   r   r@   r0    get_default_discuss_async_clientrr      s    --o>>r@   c                 ,    t         j                  d      S )N
generativern   r   r@   r0   get_default_generative_clientru          --l;;r@   c                 ,    t         j                  d      S )Ngenerative_asyncrn   r   r@   r0   #get_default_generative_async_clientry      s    --.@AAr@   c                 ,    t         j                  d      S )Ntextrn   r   r@   r0   get_default_text_clientr|      s    --f55r@   c                 ,    t         j                  d      S rS   rn   r   r@   r0   rV   rV      rv   r@   c                 ,    t         j                  d      S )Nmodelrn   r   r@   r0   get_default_model_clientr      s    --g66r@   )r   r^   r   r_   r   r^   r   z.client_options_lib.ClientOptions | dict | Noner   r`   r   r   )ra   zglm.DiscussServiceClient)ra   zglm.DiscussServiceAsyncClient)ra   zglm.GenerativeServiceClient)ra   z glm.GenerativeServiceAsyncClient)ra   zglm.TextServiceClientrc   )ra   zglm.ModelServiceAsyncClient)&
__future__r   r&   rg   r9   typingr   r   collections.abcr   google.ai.generativelanguageaigenerativelanguagerK   google.authr   ga_credentialsgoogle.api_corer   r!   r	   r
   google.generativeair   r)   ImportErrorr(   	dataclassr   r1   rk   ro   rr   ru   ry   r|   rV   r   r   r@   r0   <module>r      s   " 	    $ * * 5 @ $ )+%%K 
 Q Q Ql <@ !EI:>24'' :' ' C' 8' 0'T !"    9?<B6<7C  Ks   B; ;CC