§
    ˜Štj  ã                   óÄ   — 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dededefd„ZdS )z$Custom **exceptions** for LangChain.é    )ÚEnum)ÚAnyc                   ó   — e Zd ZdZdS )ÚLangChainExceptionzGeneral LangChain exception.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úW/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langchain_core/exceptions.pyr   r      s   € € € € € Ø&Ð&Ð&Ð&r   r   c                   ó   — e Zd ZdZdS )ÚTracerExceptionz,Base class for exceptions in tracers module.Nr   r   r   r   r   r      s   € € € € € Ø6Ð6Ð6Ð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.
    NFÚerrorÚobservationÚ
llm_outputÚsend_to_llmc                 ó  •— t          |t          ¦  «        rt          |t          j        ¬¦  «        }t          ¦   «                              |¦  «         |r|�|€d}t          |¦  «        ‚|| _        || _	        || _
        dS )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__   s”   ø€ õ4 �e�SÑ!Ô!ð 	Ý"Ø­)Ô*Jðñ ô ˆEõ 	‰Œ×Ò˜ÑÔÐØð 	"˜KÐ/°:Ð3Eð9ð õ ˜S‘/”/Ð!Ø&ˆÔØ$ˆŒØ&ˆÔÐÐr   )NNF)	r   r	   r
   r   r   r   Úboolr!   Ú__classcell__)r%   s   @r   r   r      s…   ø€ € € € € ðð ð #'Ø!%Ø!ð('ð ('àð('ð ˜4‘Zð('ð ˜$‘Jð	('ð
 ð('ð ('ð ('ð ('ð ('ð ('ð ('ð ('ð ('ð ('r   r   c                   ó   — e Zd ZdZdS )Ú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)   D   s   € € € € € ðð ð ð r   r)   c                   ó.   — e Zd ZdZdZdZdZdZdZdZ	dZ
d	S )
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+   r,   r-   r.   r/   r0   r   r   r   r   r   r   L   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   X   s+   € ð( ð 	'ð 	'àÔ#ð	'ð 	'ð 	'ðr   N)r   Úenumr   Útypingr   Ú	Exceptionr   r   r"   r   r)   r   r   r   r   r   r   ú<module>r8      s:  ðØ *Ð *à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ð'ð 'ð 'ð 'ð '˜ñ 'ô 'ð 'ð7ð 7ð 7ð 7ð 7Ð(ñ 7ô 7ð 7ð2'ð 2'ð 2'ð 2'ð 2'˜JÐ(:ñ 2'ô 2'ð 2'ðjð ð ð ð Ð-ñ ô ð ð	6ð 	6ð 	6ð 	6ð 	6�ñ 	6ô 	6ð 	6ð˜sð °	ð ¸cð ð ð ð ð ð r   