§
    $Âik!  ã                   ó4  — d Z ddlmZmZmZmZmZ ddlZddlZddl	Z	ddl
mZ er
ddlmZ ddlZ G d„ de¦  «        Z G d	„ d
e¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Zej        ZdS )z Error classes for the GenAI SDK.é    )ÚAnyÚCallableÚOptionalÚTYPE_CHECKINGÚUnionNé   )Ú_common)ÚReplayResponsec                   ó’  ‡ — e Zd ZU dZeed<   edej        df         ed<   dZ	e
e         ed<   dZe
e         ed<   	 dded	ede
edej        df                  fˆ fd
„Zdeed         eeeef                  f         fd„Zedeeef         dd fd„¦   «         Zd	edefd„Zd	edefd„Zd	edefd„Zdej        fd„Zededej        f         ddfd„¦   «         Zeded	ede
edej        df                  ddfd„¦   «         Zededej        df         ddfd„¦   «         Zeded	ede
edej        df                  ddfd„¦   «         Zˆ xZ S )ÚAPIErrorz'General errors raised by the GenAI API.Úcoder
   zaiohttp.ClientResponseÚresponseNÚstatusÚmessageÚresponse_jsonc                 ó˜  •— t          |t          ¦  «        rt          |¦  «        dk    r|d         }|| _        || _        |                      |¦  «        | _        |                      |¦  «        | _        |r|n|  	                    |¦  «        | _
        t          ¦   «                              | j
        › d| j        › d| j        › �¦  «         d S )Nr   r   ú ú. )Ú
isinstanceÚlistÚlenr   ÚdetailsÚ_get_messager   Ú_get_statusr   Ú	_get_coder   ÚsuperÚ__init__)Úselfr   r   r   Ú	__class__s       €ú]/var/www/html/jarvis.com/web/backend/venv/lib/python3.11/site-packages/google/genai/errors.pyr   zAPIError.__init__&   sÁ   ø€ õ �-¥Ñ&Ô&ð '­3¨}Ñ+=Ô+=ÀÒ+BÐ+BØ# AÔ&€mà€D„MØ €D„LØ×$Ò$ ]Ñ3Ô3€D„LØ×"Ò" =Ñ1Ô1€D„KØÐ?�� $§.¢.°Ñ"?Ô"?€D„Iå	�G„G×Ò˜œ	ÐAÐA D¤KÐAÐA°4´<ÐAÐAÑBÔBÐBÐBÐBó    Úreturn).r   c                 óR   — | j                              ¦   «         }| j        j        |ffS )zGReturns a tuple that can be used to reconstruct the error for pickling.)Ú__dict__Úcopyr   Ú_rebuild)r   Ústates     r    Ú
__reduce__zAPIError.__reduce__9   s)   € ð ŒM×ÒÑ Ô €EØŒNÔ# e XÐ.Ð.r!   r'   c                 óÜ   — t                                t           ¦  «        }|j                             | ¦  «         t                               ||j        › d|j        › d|j        › �¦  «         |S )z"Rebuilds the error from the state.r   r   )	r   Ú__new__r$   ÚupdateÚ	Exceptionr   r   r   r   )r'   Úobjs     r    r&   zAPIError._rebuild@   sd   € õ ×
Ò
�8Ñ
$Ô
$€CØ„L×Ò˜ÑÔÐÝ×Ò�s˜sœxÐEÐE¨#¬*ÐEÐE¸¼ÐEÐEÑFÔFÐFØ€Jr!   c                 ó¦   — 	 |                      d|                      di ¦  «                              dd ¦  «        ¦  «        }|S # t          $ r Y d S w xY w)Nr   Úerror©ÚgetÚAttributeError)r   r   r   s      r    r   zAPIError._get_statusH   sl   € ðØ× Ò Ø
�M×%Ò% g¨rÑ2Ô2×6Ò6°xÀÑFÔFñô €fð €møÝð ð ð ð ˆTˆTðøøøó   ‚?A Á
AÁAc                 ó¦   — 	 |                      d|                      di ¦  «                              dd ¦  «        ¦  «        }|S # t          $ r Y d S w xY w)Nr   r/   r0   )r   r   r   s      r    r   zAPIError._get_messageS   sl   € ðØ×!Ò!Ø
�]×&Ò& w°Ñ3Ô3×7Ò7¸	À4ÑHÔHñô €gð €nøÝð ð ð ð ˆTˆTðøøør3   c                 ó~   — |                      d|                      di ¦  «                              dd ¦  «        ¦  «        S )Nr   r/   )r1   )r   r   s     r    r   zAPIError._get_code^   s?   € Ø×ÒØ�×!Ò! '¨2Ñ.Ô.×2Ò2°6¸4Ñ@Ô@ñô ð r!   c                 ó0   — d| j         | j        | j        dœiS )z©Returns a dictionary representation of the error for replay recording.

    details is not included since it may expose internal information in the
    replay file.
    r/   ©r   r   r   r7   )r   s    r    Ú_to_replay_recordzAPIError._to_replay_recordc   s*   € ð 	Ø”IØ”|Ø”kð
ð 
ðð r!   c                 óx  — |j         dk    rdS t          |t          j        ¦  «        rU	 |                     ¦   «          |                     ¦   «         }nL# t
          j        j        $ r |j        }||j	        dœ}Y n%w xY w|j
        d                              di ¦  «        }|                      |j         ||¦  «         dS )úPRaises an error with detailed error message if the response has an error status.éÈ   N©r   r   r   r/   )Ústatus_coder   ÚhttpxÚResponseÚreadÚjsonÚdecoderÚJSONDecodeErrorÚtextÚreason_phraseÚbody_segmentsr1   Úraise_error)Úclsr   r   r   s       r    Úraise_for_responsezAPIError.raise_for_responseq   sË   € ð
 Ô˜sÒ"Ð"Ø€få�(�EœNÑ+Ô+ð Að
Ø�Š‰ŒˆØ Ÿš™œˆˆøÝŒ\Ô)ð 
ð 
ð 
Ø”-ˆàØÔ,ð
ð 
ˆˆˆð
øøøð Ô,¨QÔ/×3Ò3°G¸RÑ@Ô@€mà‡O‚O�HÔ(¨-¸ÑBÔBÐBÐBÐBs   ©(A Á%A:Á9A:r=   c                 ó    — d|cxk    rdk     rn nt          |||¦  «        ‚d|cxk    rdk     rn nt          |||¦  «        ‚ | |||¦  «        ‚©aÉ  Raises an appropriate APIError subclass based on the status code.

    Args:
      status_code: The HTTP status code of the response.
      response_json: The JSON body of the response, or a dict containing error
        details.
      response: The original response object.

    Raises:
      ClientError: If the status code is in the 4xx range.
      ServerError: If the status code is in the 5xx range.
      APIError: For other error status codes.
    i�  iô  iX  ©ÚClientErrorÚServerError©rH   r=   r   r   s       r    rG   zAPIError.raise_errorˆ   s€   € ð, ˆkÐÐÒÐ˜CÒÐÐÐÐÝ˜ ]°HÑ=Ô=Ð=Ø	�Ð	!Ð	!Ò	!Ð	!˜cÒ	!Ð	!Ð	!Ð	!Ð	!Ý˜ ]°HÑ=Ô=Ð=àˆC�˜]¨HÑ5Ô5Ð5r!   c              ƒ   ó°  K  — d}d}t          |t          j        ¦  «        rq|j        dk    rdS 	 |                     ¦   «         ƒ d{V —† |                     ¦   «         }n+# t
          j        j        $ r |j        }||j	        dœ}Y nw xY w|j        }�n't          |d¦  «        rFt          |d¦  «        r6|j        dk    rdS |j        d                              di ¦  «        }|j        }nÑ	 ddl}t          ||j        ¦  «        rj|j        dk    rdS 	 |                     ¦   «         ƒ d{V —†}n9# |j        j        $ r' |                     ¦   «         ƒ d{V —†}||j        dœ}Y nw xY w|j        }nt'          dt)          |¦  «        › �¦  «        ‚n-# t*          $ r  t'          dt)          |¦  «        › �¦  «        ‚w xY w|                      |||¦  «        ƒ d{V —† dS )	r:   r   Nr;   r<   rF   r=   r/   zUnsupported response type: )r   r>   r?   r=   ÚareadrA   rB   rC   rD   rE   ÚhasattrrF   r1   ÚaiohttpÚClientResponser   Úclient_exceptionsÚContentTypeErrorÚreasonÚ
ValueErrorÚtypeÚImportErrorÚraise_error_async)rH   r   r=   r   r   rS   s         r    Úraise_for_async_responsez!APIError.raise_for_async_response¥   st  è è € ð €KØ€MÝ�(�EœNÑ+Ô+ð 'IØ	Ô	 Ò	$Ð	$Øˆð
Ø�nŠnÑÔÐÐÐÐÐÐÐØ Ÿš™œˆˆøÝŒ\Ô)ð 
ð 
ð 
Ø”-ˆàØÔ,ð
ð 
ˆˆˆð
øøøð Ô(€k�kÝ	�˜?Ñ	+Ô	+ð IµØ�-ñ1ô 1ð Ið 
Ô	 Ò	$Ð	$ØˆØÔ,¨QÔ/×3Ò3°G¸RÑ@Ô@€mØÔ(€k€kðIØˆˆˆå�h Ô 6Ñ7Ô7ð 	KØŒ_ Ò#Ð#ØˆFðØ"*§-¢-¡/¤/Ð1Ð1Ð1Ð1Ð1Ð1ˆMˆMøØÔ*Ô;ð ð ð Ø$ŸMšM™OœOÐ+Ð+Ð+Ð+Ð+Ð+ˆGà"Ø"œ/ðð ˆMˆMˆMðøøøð !œˆ+ˆ+åÐI½¸h¹¼ÐIÐIÑJÔJÐ
Jð øõ ð Ið Ið IÝÐGµt¸H±~´~ÐGÐGÑHÔHÐHðIøøøð ×
Ò
 ¨]¸HÑ
EÔ
EÐEÐEÐEÐEÐEÐEÐEÐEÐEsA   ¯.A Á%BÂBÃ)$F ÄD+ Ä*F Ä+3E!ÅF Å E!Å!*F Æ*F6c              ƒ   ó¤   K  — d|cxk    rdk     rn nt          |||¦  «        ‚d|cxk    rdk     rn nt          |||¦  «        ‚ | |||¦  «        ‚rK   rL   rO   s       r    r[   zAPIError.raise_error_asyncÚ   s„   è è € ð& ˆkÐÐÒÐ˜CÒÐÐÐÐÝ˜ ]°HÑ=Ô=Ð=Ø	�Ð	!Ð	!Ò	!Ð	!˜cÒ	!Ð	!Ð	!Ð	!Ð	!Ý˜ ]°HÑ=Ô=Ð=àˆC�˜]¨HÑ5Ô5Ð5r!   )N)!Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚintÚ__annotations__r   r>   r?   r   r   Ústrr   r   r   Útupler   Údictr(   Ústaticmethodr&   r   r   r   r	   Ú
StringDictr8   ÚclassmethodrI   rG   r\   r[   Ú__classcell__)r   s   @r    r   r      s  ø€ € € € € € Ø/Ð/Ø€)€)�)ØÐ" E¤NÐ4LÐLÔMÐMÐMÑMà€&ˆ(�3Œ-ÐÐÑØ€'ˆ8�CŒ=ÐÐÑð ðCð CàðCð ðCð Ø
Ð  %¤.Ð2JÐJÔ
Kôð	Cð Cð Cð Cð Cð Cð&/àˆX�oÔ&¨¨d°3¸°8¬nÔ(=Ð=Ô>ð/ð /ð /ð /ð ð�d˜3 ˜8”nð ¨ð ð ð ñ „<ðð	 sð 	¨sð 	ð 	ð 	ð 	ð	¨ð 	°ð 	ð 	ð 	ð 	ð Sð ¨Sð ð ð ð ð
 Ô!3ð ð ð ð ð ðCØÐ+¨U¬^Ð;Ô<ðCàðCð Cð Cñ „;ðCð, ð6àð6ð ð6ð Ø
Ð  %¤.Ð2JÐJÔ
Kôð	6ð ð6ð 6ð 6ñ „;ð6ð8 ð2FàØ
˜EœNÐ,DÐ
Dôð2Fð
 ð2Fð 2Fð 2Fñ „;ð2Fðh ð6Øð6Ø,/ð6Ø;CØ
Ð  %¤.Ð2JÐJÔ
Kô<ð6ð ð	6ð 6ð 6ñ „;ð6ð 6ð 6ð 6ð 6r!   r   c                   ó   — e Zd ZdZdS )rM   z%Client error raised by the GenAI API.N©r^   r_   r`   ra   © r!   r    rM   rM   õ   ó   € € € € € Ø-Ð-Ø€$r!   rM   c                   ó   — e Zd ZdZdS )rN   z%Server error raised by the GenAI API.Nrl   rm   r!   r    rN   rN   ú   rn   r!   rN   c                   ó   — e Zd ZdZdS )Ú UnknownFunctionCallArgumentErrorzWRaised when the function call argument cannot be converted to the parameter annotation.Nrl   rm   r!   r    rq   rq   ÿ   s   € € € € € Ø_Ð_Ø€$r!   rq   c                   ó   — e Zd ZdZdS )ÚUnsupportedFunctionErrorz*Raised when the function is not supported.Nrl   rm   r!   r    rs   rs     s   € € € € € Ø2Ð2Ø€$r!   rs   c                   ó   — e Zd ZdZdS )ÚFunctionInvocationErrorzDRaised when the function cannot be invoked with the given arguments.Nrl   rm   r!   r    ru   ru   	  s   € € € € € ØLÐLØ€$r!   ru   c                   ó   — e Zd ZdZdS )ÚUnknownApiResponseErrorz?Raised when the response from the API cannot be parsed as JSON.Nrl   rm   r!   r    rw   rw     s   € € € € € ØGÐGØ€$r!   rw   )ra   Útypingr   r   r   r   r   r>   rA   Ú
websocketsÚ r	   Úreplay_api_clientr
   rS   r,   r   rM   rN   rX   rq   rs   ru   rw   ÚExperimentalWarningrm   r!   r    ú<module>r}      sÌ  ðð  'Ð &à @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ø €€€Ø €€€Ø Ð Ð Ð Ø Ð Ð Ð Ð Ð ð ð Ø/Ð/Ð/Ð/Ð/Ð/Ø€.€.€.ðT6ð T6ð T6ð T6ð T6ˆyñ T6ô T6ð T6ðnð ð ð ð �(ñ ô ð ð
ð ð ð ð �(ñ ô ð ð
ð ð ð ð  zñ ô ð ð
ð ð ð ð ˜zñ ô ð ð
ð ð ð ð ˜jñ ô ð ð
ð ð ð ð ˜jñ ô ð ð Ô1Ð Ð Ð r!   