
    ?h                     h    d dl Z d dlmZmZ d dlmZ 	  ed      Z G d d      Zy# e$ r dZY w xY w)    N)versionPackageNotFoundError)Optionalzweaviate-clientzunknown versionc                       e Zd Zedd       Zeddee   ddfd       Zededdfd       Zedd       Z	ed	e
ddfd
       Zede
ddfd       Zedd       Zede
ddfd       Zededdfd       Zy)	_WarningsreturnNc                  <    t        j                  dt        d       y )NzAuth001: The client was configured to use authentication, but weaviate is configured without
                    authentication. Are you sure this is correct?   messagecategory
stacklevelwarningswarnUserWarning     O/home/chris/cleankitchens-env/lib/python3.12/site-packages/weaviate/warnings.pyauth_with_anon_weaviatez!_Warnings.auth_with_anon_weaviate   s    E 		
r   auth_lenc                 Z    | d|  d}nd}t        j                  d| dt        d       y )Nz+The current access token is only valid for zs.z#Also, no expiration time was given.zYAuth002: The token returned from you identity provider does not contain a refresh token. a  

            Access to your weaviate instance is not possible after expiration and this client will return an
            authentication exception.

            Things to try:
            - You might need to enable refresh tokens in the settings of your authentication provider
            - You might need to send the correct scope. For some providers it needs to include "offline_access"
            r
   r   r   )r   msgs     r   auth_no_refresh_tokenz_Warnings.auth_no_refresh_token   sC    ?zLC7Cqruqv w  !	
r   
expires_inc                 H    d|  d}t        j                  |t        d       y )Nz3Auth003: Access token expiration time is negative: .r
   r   r   )r   r   s     r   auth_negative_expiration_timez'_Warnings.auth_negative_expiration_time*   s!    Ej\QRUcKAFr   c                  @    d} t        j                  | t        d       y )Na  Auth004: Received an authentication header and an auth_client_secret parameter.

         The auth_client_secret takes precedence over the header and the authentication header will be ignored. Use
         weaviate.auth.AuthBearerToken(..) to supply an access token via auth_client_secret parameter and (if available)
         also supply refresh tokens and token lifetimes.
         r
   r   r   )r   s    r   auth_header_and_auth_secretz%_Warnings.auth_header_and_auth_secret0   s     	cKAFr   urlc                 H    d|  d}t        j                  |t        d       y )Na7  Auth005: Could not parse Weaviates OIDC configuration, using unauthenticated access. If you added
        an authorization header yourself it will be unaffected.

        This can happen if weaviate is miss-configured or you have a proxy inbetween the client and weaviate.
        You can test this by visiting r   r
   r   r   )r!   r   s     r   auth_cannot_parse_oidc_configz'_Warnings.auth_cannot_parse_oidc_config:   s)    ' (+e1	0
 	cKAFr   server_versionc                 R    t        j                  dt         d|  dt        d       y )Nz9Dep001: You are using the Weaviate Python Client version zi which supports
            changes and features of Weaviate >=1.14.x, but you are connected to Weaviate z.
            If you want to make use of these new changes/features using this Python Client version, upgrade your
            Weaviate instance.r
   r   )r   r   __version__DeprecationWarningr$   s    r   weaviate_server_older_than_1_14z)_Warnings.weaviate_server_older_than_1_14C   s7    QR]Q^ _ZZhYi j" (	
r   c                  <    t        j                  dt        d       y )NaX  Dep002: You are batching manually. This means you are NOT using the client's built-in
            multi-threading. Setting `batch_size` in `client.batch.configure()`  to an int value will enabled automatic
            batching. See:
            https://weaviate.io/developers/weaviate/current/restful-api-references/batch.html#example-request-1r
   r   r   r   r'   r   r   r   manual_batchingz_Warnings.manual_batchingN   s    s (	
r   c                 D    t        j                  d|  dt        d       y )NzWDep003: You are trying to use the generative search, but you are connected to Weaviate zQ.
            Support for generative search was added in weaviate version 1.17.3.r
   r   r+   r(   s    r   weaviate_too_old_for_openaiz%_Warnings.weaviate_too_old_for_openaiY   s*    op~o @P S'		
r   excc                 D    t        j                  d|  dt        d       y )NaA  Con001: Could not reach token issuer for the periodic refresh. This client will automatically
            retry to refresh. If this does not succeed, the client will become unauthenticated.
            Causes might be an unstable internet connection or a problem with your authentication provider.
            Exception: z
            r
   r   r   )r/   s    r   token_refresh_failedz_Warnings.token_refresh_failedb   s,     u 
 !	
r   )r   N)N)__name__
__module____qualname__staticmethodr   r   intr   r   r    strr#   r)   r,   r.   	Exceptionr1   r   r   r   r   r      s   
 
 
 
 
 
( G# G$ G G
 G G G3 G4 G G 
 
 
 
 
 
 
C 
D 
 
 	
) 	
 	
 	
r   r   )r   importlib.metadatar   r   typingr   r&   r   r   r   r   <module>r;      s@     < $+,K
a
 a
	  $#K$s   ' 11