Ë
    ñÏjd  ã                   ój  — d Z ddlmZ ddlmZ  G d„ de«      Z G d„ de«      Z G d„ d	e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 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d ed!ed"efd#„Zy$)%z$Custom **exceptions** for LangChain.é    )ÚEnum)ÚAnyc                   ó   — e Zd ZdZy)ÚLangChainExceptionzGeneral LangChain exception.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úV/var/www/html/gaurav-v2/venv/lib/python3.12/site-packages/langchain_core/exceptions.pyr   r      s   „ Ú&r   r   c                   ó   — e Zd ZdZy)ÚTracerExceptionz,Base class for exceptions in tracers module.Nr   r   r   r   r   r      s   „ Ú6r   r   c            	       óH   ‡ — e Zd ZdZ	 	 	 ddededz  dedz  defˆ fd„Zˆ xZS )	ÚOutputParserExceptiona^  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                 óÊ   •— t        |t        «      rt        |t        j                  ¬«      }t
        ‰| �  |«       |r|�|€d}t        |«      ‚|| _        || _	        || _
        y)aV  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!   zOutputParserException.__init__   sm   ø€ ô4 �eœSÔ!Ü"Ø¬)×*JÑ*JôˆEô 	‰Ñ˜ÔÙ˜KÐ/°:Ð3Eð9ð ô ˜S“/Ð!Ø&ˆÔØ$ˆŒØ&ˆÕr   )NNF)	r   r	   r
   r   r   r   Úboolr!   Ú__classcell__)r%   s   @r   r   r      sK   ø„ ñð #'Ø!%Ø!ñ('àð('ð ˜4‘Zð('ð ˜$‘Jð	('ð
 ÷('ñ ('r   r   c                   ó   — e Zd ZdZdZy)Ú
ModelErrora®  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.
    FN©r   r	   r
   r   Úis_retryabler   r   r   r)   r)   D   s   „ ñð €LØ>r   r)   c                   ó   — e Zd ZdZy)ÚModelAuthenticationErrorzEException raised when model provider authentication fails (HTTP 401).Nr   r   r   r   r-   r-   S   ó   „ ÚOr   r-   c                   ó   — e Zd ZdZy)ÚModelPermissionDeniedErrorzKException raised when credentials lack permission for a request (HTTP 403).Nr   r   r   r   r0   r0   W   s   „ ÚUr   r0   c                   ó   — e Zd ZdZy)ÚModelInvalidRequestErrorzNException raised when a provider rejects a request as invalid (e.g. HTTP 400).Nr   r   r   r   r2   r2   [   s   „ ÚXr   r2   c                   ó   — e Zd ZdZy)ÚModelNotFoundErrorzEException raised when the requested model cannot be found (HTTP 404).Nr   r   r   r   r4   r4   _   r.   r   r4   c                   ó   — e Zd ZdZdZy)ÚModelRateLimitErrorzIException raised when a model provider rate limit is exceeded (HTTP 429).TNr*   r   r   r   r6   r6   c   s
   „ ÙSà�Lr   r6   c                   ó   — e Zd ZdZdZy)ÚModelAPIErrorzKException raised when a model provider reports a server failure (HTTP 5xx).TNr*   r   r   r   r8   r8   i   s
   „ ÙUà�Lr   r8   c                   ó   — e Zd ZdZdZy)ÚModelConnectionErrorz9Exception raised when a model provider cannot be reached.TNr*   r   r   r   r:   r:   o   s
   „ ÙCà�Lr   r:   c                   ó   — e Zd ZdZdZy)ÚModelTimeoutErrorz0Exception raised when a model request times out.TNr*   r   r   r   r<   r<   u   s
   „ Ù:à�Lr   r<   c                   ó   — e Zd ZdZy)ÚContextOverflowErrorzÄ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.
    Nr   r   r   r   r>   r>   {   s   „ òr   r>   c                   ó,   — e Zd ZdZdZdZdZdZdZdZ	dZ
y	)
r   zError codes.ÚINVALID_PROMPT_INPUTÚINVALID_TOOL_RESULTSÚMESSAGE_COERCION_FAILUREÚMODEL_AUTHENTICATIONÚMODEL_NOT_FOUNDÚMODEL_RATE_LIMITr   N)r   r	   r
   r   r@   rA   rB   rC   rD   rE   r   r   r   r   r   r   ƒ   s.   „ Ùà1ÐØ1ÐØ9ÐØ1ÐØ'€OØ)ÐØ5Ñr   r   r   r   Úreturnc                 ó&   — | › d|j                   › d�S )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)   r-   r0   r2   r4   r6   r8   r:   r<   r>   r   r   r   r   r   r   Ú<module>rM      sÞ   ðÙ *å Ý ô'˜ô 'ô7Ð(ô 7ô2'˜JÐ(:ô 2'ôj?Ð#ô ?ôP˜zô PôV ô VôY˜zô YôP˜ô Pô˜*ô ô�Jô ô˜:ô ô˜
ô ô˜:ô ô	6�ô 	6ð˜sð °	ð ¸cô r   