ó
    üÞ jd  ã                   ól  • S r SSKJr  SSKJr   " S S\5      r " S S\5      r " S S	\\5      r	 " S
 S\5      r
 " S S\
5      r " S S\
5      r " S S\
5      r " S S\
5      r " S S\
5      r " S S\
5      r " S S\
5      r " S S\
5      r " S S\
5      r " S S\5      rS \S!\S"\4S# jrg$)%z$Custom **exceptions** for LangChain.é    )ÚEnum)ÚAnyc                   ó   • \ rS rSrSrSrg)ÚLangChainExceptioné   zGeneral LangChain exception.© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    ÚS/var/www/html/gaurav/venv/lib/python3.13/site-packages/langchain_core/exceptions.pyr   r      s   † Ü&r   r   c                   ó   • \ rS rSrSrSrg)ÚTracerExceptioné   z,Base class for exceptions in tracers module.r   Nr	   r   r   r   r   r      s   † Ü6r   r   c            	       óV   ^ • \ rS rSrSr   S
S\S\S-  S\S-  S\4U 4S jjjrS	r	U =r
$ )ÚOutputParserExceptioné   aJ  Exception that output parsers should raise to signify a parsing error.

This exists to differentiate parsing errors from other code or execution errors
that also may arise inside the output parser.

`OutputParserException` will be available to catch and handle in ways to fix the
parsing error, while other errors will be raised.
NÚerrorÚobservationÚ
llm_outputÚsend_to_llmc                 óÖ   >• [        U[        5      (       a  [        U[        R                  S9n[
        TU ]  U5        U(       a  Ub  Uc  Sn[        U5      eX l        X0l	        X@l
        g)aæ  Create an `OutputParserException`.

Args:
    error: The error that's being re-raised or an error message.
    observation: String explanation of error which can be passed to a model to
        try and remediate the issue.
    llm_output: String model output which is error-ing.

    send_to_llm: Whether to send the observation and llm_output back to an Agent
        after an `OutputParserException` has been raised.

        This gives the underlying model driving the agent the context that the
        previous output was improperly structured, in the hopes that it will
        update the output to the correct format.

Raises:
    ValueError: If `send_to_llm` is `True` but either observation or
        `llm_output` are not provided.
©ÚmessageÚ
error_codeNzLArguments 'observation' & 'llm_output' are required if 'send_to_llm' is True)Ú
isinstanceÚstrÚcreate_messageÚ	ErrorCodeÚOUTPUT_PARSING_FAILUREÚsuperÚ__init__Ú
ValueErrorr   r   r   )Úselfr   r   r   r   ÚmsgÚ	__class__s         €r   r&   ÚOutputParserException.__init__   sj   ø€ ô4 �eœS×!Ñ!Ü"Ø¬)×*JÑ*JñˆEô 	‰Ñ˜ÔÞ˜KÑ/°:Ñ3Eð9ð ô ˜S“/Ð!Ø&ÔØ$ŒØ&Õr   )r   r   r   )NNF)r
   r   r   r   r   r   r!   Úboolr&   r   Ú__classcell__)r*   s   @r   r   r      sK   ø† ñð #'Ø!%Ø!ñ('àð('ð ˜4‘Zð('ð ˜$‘Jð	('ð
 ÷('ö ('r   r   c                   ó   • \ rS rSrSrSrSrg)Ú
ModelErroréD   a–  Base exception for failures related to model invocation.

Subclasses correspond to conditions that model providers report consistently,
keyed to the HTTP status they surface it with, so the same condition maps to
the same exception type regardless of provider.

Provider integrations raise subclasses that also inherit from the provider
SDK's own exception type, so code catching either continues to work.
Fr   N©r
   r   r   r   r   Úis_retryabler   r   r   r   r/   r/   D   s   † ñð €LÚ>r   r/   c                   ó   • \ rS rSrSrSrg)ÚModelAuthenticationErroréS   zEException raised when model provider authentication fails (HTTP 401).r   Nr	   r   r   r   r4   r4   S   ó   † ÜOr   r4   c                   ó   • \ rS rSrSrSrg)ÚModelPermissionDeniedErroréW   zKException raised when credentials lack permission for a request (HTTP 403).r   Nr	   r   r   r   r8   r8   W   s   † ÜUr   r8   c                   ó   • \ rS rSrSrSrg)ÚModelInvalidRequestErroré[   zNException raised when a provider rejects a request as invalid (e.g. HTTP 400).r   Nr	   r   r   r   r;   r;   [   s   † ÜXr   r;   c                   ó   • \ rS rSrSrSrg)ÚModelNotFoundErroré_   zEException raised when the requested model cannot be found (HTTP 404).r   Nr	   r   r   r   r>   r>   _   r6   r   r>   c                   ó   • \ rS rSrSrSrSrg)ÚModelRateLimitErroréc   zIException raised when a model provider rate limit is exceeded (HTTP 429).Tr   Nr1   r   r   r   rA   rA   c   s
   † ÙSàƒLr   rA   c                   ó   • \ rS rSrSrSrSrg)ÚModelAPIErroréi   zKException raised when a model provider reports a server failure (HTTP 5xx).Tr   Nr1   r   r   r   rD   rD   i   s
   † ÙUàƒLr   rD   c                   ó   • \ rS rSrSrSrSrg)ÚModelConnectionErroréo   z9Exception raised when a model provider cannot be reached.Tr   Nr1   r   r   r   rG   rG   o   s
   † ÙCàƒLr   rG   c                   ó   • \ rS rSrSrSrSrg)ÚModelTimeoutErroréu   z0Exception raised when a model request times out.Tr   Nr1   r   r   r   rJ   rJ   u   s
   † Ù:àƒLr   rJ   c                   ó   • \ rS rSrSrSrg)ÚContextOverflowErroré{   z¸Exception raised when input exceeds the model's context limit.

This exception is raised by chat models when the input tokens exceed
the maximum context window supported by the model.
r   Nr	   r   r   r   rM   rM   {   s   † ôr   rM   c                   ó4   • \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rg)r#   éƒ   zError codes.ÚINVALID_PROMPT_INPUTÚINVALID_TOOL_RESULTSÚMESSAGE_COERCION_FAILUREÚMODEL_AUTHENTICATIONÚMODEL_NOT_FOUNDÚMODEL_RATE_LIMITr$   r   N)r
   r   r   r   r   rQ   rR   rS   rT   rU   rV   r$   r   r   r   r   r#   r#   ƒ   s.   † Ùà1ÐØ1ÐØ9ÐØ1ÐØ'€OØ)ÐØ5Ór   r#   r   r   Úreturnc                 ó&   • U  SUR                    S3$ )a±  Create a message with a link to the LangChain troubleshooting guide.

Args:
    message: The message to display.
    error_code: The error code to display.

Returns:
    The full message with the troubleshooting link.

Example:
    ```python
    create_message(
        message="Failed to parse output",
        error_code=ErrorCode.OUTPUT_PARSING_FAILURE,
    )
    "Failed to parse output. For troubleshooting, visit: ..."
    ```
zT
For troubleshooting, visit: https://docs.langchain.com/oss/python/langchain/errors/Ú )Úvaluer   s     r   r"   r"   �   s&   € ð( ˆ)ð à×#Ñ#Ð$ Að	'ðr   N)r   Úenumr   Útypingr   Ú	Exceptionr   r   r'   r   r/   r4   r8   r;   r>   rA   rD   rG   rJ   rM   r#   r!   r"   r   r   r   Ú<module>r^      sÞ   ðÙ *å Ý ô'˜ô 'ô7Ð(ô 7ô2'˜JÐ(:ô 2'ôj?Ð#ô ?ôP˜zô PôV ô VôY˜zô YôP˜ô Pô˜*ô ô�Jô ô˜:ô ô˜
ô ô˜:ô ô	6�ô 	6ð˜sð °	ð ¸cõ r   