o
    {qi                     @  s  d dl mZ d dlZd dlmZmZmZ d dlmZ d dl	m
Z
mZmZmZmZmZmZ d dlmZmZmZ d dlmZmZ d dlmZmZ d d	lmZmZmZ d d
lm Z  d dl!m"Z" d dl#m$Z$m%Z% d dl&m'Z' d dl(m)Z)m*Z* g dZ+eddddd<ddZ,e	d=ddddd>ddZ,e	d=dd ddd?d"dZ,	d=ddddd@d%dZ,dd&dAd'd(Z-h d)Z.dBd+d,Z/dCd.d/Z0dd0dDd4d5Z1dEd8d9Z2d:Z3G d;d deee
f Z4dS )F    )annotationsN)AsyncIteratorIteratorSequence)util)AnyCallableLiteralOptionalUnioncastoverload)BaseChatModelLanguageModelInputSimpleChatModel)agenerate_from_streamgenerate_from_stream)
AnyMessageBaseMessage)RunnableRunnableConfigensure_config)StreamEvent)BaseTool)RunLogRunLogPatch)	BaseModel)	TypeAliasoverride)r   r   r   r   init_chat_model)model_providerconfigurable_fieldsconfig_prefixmodelstrr    Optional[str]r!   Literal[None]r"   kwargsr   returnr   c                K     d S N r#   r    r!   r"   r'   r+   r+   a/home/app/PaddleOCR-VL/.venv_paddleocr/lib/python3.10/site-packages/langchain/chat_models/base.pyr   +      r   _ConfigurableModelc                K  r)   r*   r+   r,   r+   r+   r-   r   6   r.   .1Union[Literal['any'], list[str], tuple[str, ...]]c                K  r)   r*   r+   r,   r+   r+   r-   r   A   r.   ;Optional[Union[Literal['any'], list[str], tuple[str, ...]]](Union[BaseChatModel, _ConfigurableModel]c                K  sv   | s|sd}|p	d}|r|st jd|ddd |s(ttt| fd|i|S | r.| |d< |r4||d< t|||d	S )
a'  Initialize a ChatModel in a single line using the model's name and provider.

    .. note::
        Must have the integration package corresponding to the model provider installed.
        You should look at the `provider integration's API reference <https://python.langchain.com/api_reference/reference.html#integrations>`__
        to see what parameters are supported by the model.

    Args:
        model: The name of the model, e.g. ``'o3-mini'``, ``'claude-3-5-sonnet-latest'``. You can
            also specify model and model provider in a single argument using
            ``'{model_provider}:{model}'`` format, e.g. ``'openai:o1'``.
        model_provider: The model provider if not specified as part of model arg (see
            above). Supported model_provider values and the corresponding integration
            package are:

            - ``openai``              -> ``langchain-openai``
            - ``anthropic``           -> ``langchain-anthropic``
            - ``azure_openai``        -> ``langchain-openai``
            - ``azure_ai``            -> ``langchain-azure-ai``
            - ``google_vertexai``     -> ``langchain-google-vertexai``
            - ``google_genai``        -> ``langchain-google-genai``
            - ``bedrock``             -> ``langchain-aws``
            - ``bedrock_converse``    -> ``langchain-aws``
            - ``cohere``              -> ``langchain-cohere``
            - ``fireworks``           -> ``langchain-fireworks``
            - ``together``            -> ``langchain-together``
            - ``mistralai``           -> ``langchain-mistralai``
            - ``huggingface``         -> ``langchain-huggingface``
            - ``groq``                -> ``langchain-groq``
            - ``ollama``              -> ``langchain-ollama``
            - ``google_anthropic_vertex``    -> ``langchain-google-vertexai``
            - ``deepseek``            -> ``langchain-deepseek``
            - ``ibm``                 -> ``langchain-ibm``
            - ``nvidia``              -> ``langchain-nvidia-ai-endpoints``
            - ``xai``                 -> ``langchain-xai``
            - ``perplexity``          -> ``langchain-perplexity``

            Will attempt to infer model_provider from model if not specified. The
            following providers will be inferred based on these model prefixes:

            - ``gpt-3...`` | ``gpt-4...`` | ``o1...`` -> ``openai``
            - ``claude...``                       -> ``anthropic``
            - ``amazon...``                       -> ``bedrock``
            - ``gemini...``                       -> ``google_vertexai``
            - ``command...``                      -> ``cohere``
            - ``accounts/fireworks...``           -> ``fireworks``
            - ``mistral...``                      -> ``mistralai``
            - ``deepseek...``                     -> ``deepseek``
            - ``grok...``                         -> ``xai``
            - ``sonar...``                        -> ``perplexity``
        configurable_fields: Which model parameters are configurable:

            - None: No configurable fields.
            - ``'any'``: All fields are configurable. **See Security Note below.**
            - Union[List[str], Tuple[str, ...]]: Specified fields are configurable.

            Fields are assumed to have config_prefix stripped if there is a
            config_prefix. If model is specified, then defaults to None. If model is
            not specified, then defaults to ``("model", "model_provider")``.

            ***Security Note***: Setting ``configurable_fields="any"`` means fields like
            ``api_key``, ``base_url``, etc. can be altered at runtime, potentially redirecting
            model requests to a different service/user. Make sure that if you're
            accepting untrusted configurations that you enumerate the
            ``configurable_fields=(...)`` explicitly.

        config_prefix: If ``'config_prefix'`` is a non-empty string then model will be
            configurable at runtime via the
            ``config["configurable"]["{config_prefix}_{param}"]`` keys. If
            ``'config_prefix'`` is an empty string then model will be configurable via
            ``config["configurable"]["{param}"]``.
        temperature: Model temperature.
        max_tokens: Max output tokens.
        timeout: The maximum time (in seconds) to wait for a response from the model
            before canceling the request.
        max_retries: The maximum number of attempts the system will make to resend a
            request if it fails due to issues like network timeouts or rate limits.
        base_url: The URL of the API endpoint where requests are sent.
        rate_limiter: A ``BaseRateLimiter`` to space out requests to avoid exceeding
            rate limits.
        kwargs: Additional model-specific keyword args to pass to
            ``<<selected ChatModel>>.__init__(model=model_name, **kwargs)``.

    Returns:
        A BaseChatModel corresponding to the model_name and model_provider specified if
        configurability is inferred to be False. If configurable, a chat model emulator
        that initializes the underlying model at runtime once a config is passed in.

    Raises:
        ValueError: If model_provider cannot be inferred or isn't supported.
        ImportError: If the model provider integration package is not installed.

    .. dropdown:: Init non-configurable model
        :open:

        .. code-block:: python

            # pip install langchain langchain-openai langchain-anthropic langchain-google-vertexai
            from langchain.chat_models import init_chat_model

            o3_mini = init_chat_model("openai:o3-mini", temperature=0)
            claude_sonnet = init_chat_model("anthropic:claude-3-5-sonnet-latest", temperature=0)
            gemini_2_flash = init_chat_model("google_vertexai:gemini-2.0-flash", temperature=0)

            o3_mini.invoke("what's your name")
            claude_sonnet.invoke("what's your name")
            gemini_2_flash.invoke("what's your name")


    .. dropdown:: Partially configurable model with no default

        .. code-block:: python

            # pip install langchain langchain-openai langchain-anthropic
            from langchain.chat_models import init_chat_model

            # We don't need to specify configurable=True if a model isn't specified.
            configurable_model = init_chat_model(temperature=0)

            configurable_model.invoke(
                "what's your name",
                config={"configurable": {"model": "gpt-4o"}}
            )
            # GPT-4o response

            configurable_model.invoke(
                "what's your name",
                config={"configurable": {"model": "claude-3-5-sonnet-latest"}}
            )
            # claude-3.5 sonnet response

    .. dropdown:: Fully configurable model with a default

        .. code-block:: python

            # pip install langchain langchain-openai langchain-anthropic
            from langchain.chat_models import init_chat_model

            configurable_model_with_default = init_chat_model(
                "openai:gpt-4o",
                configurable_fields="any",  # this allows us to configure other params like temperature, max_tokens, etc at runtime.
                config_prefix="foo",
                temperature=0
            )

            configurable_model_with_default.invoke("what's your name")
            # GPT-4o response with temperature 0

            configurable_model_with_default.invoke(
                "what's your name",
                config={
                    "configurable": {
                        "foo_model": "anthropic:claude-3-5-sonnet-20240620",
                        "foo_temperature": 0.6
                    }
                }
            )
            # Claude-3.5 sonnet response with temperature 0.6

    .. dropdown:: Bind tools to a configurable model

        You can call any ChatModel declarative methods on a configurable model in the
        same way that you would with a normal model.

        .. code-block:: python

            # pip install langchain langchain-openai langchain-anthropic
            from langchain.chat_models import init_chat_model
            from pydantic import BaseModel, Field

            class GetWeather(BaseModel):
                '''Get the current weather in a given location'''

                location: str = Field(..., description="The city and state, e.g. San Francisco, CA")

            class GetPopulation(BaseModel):
                '''Get the current population in a given location'''

                location: str = Field(..., description="The city and state, e.g. San Francisco, CA")

            configurable_model = init_chat_model(
                "gpt-4o",
                configurable_fields=("model", "model_provider"),
                temperature=0
            )

            configurable_model_with_tools = configurable_model.bind_tools([GetWeather, GetPopulation])
            configurable_model_with_tools.invoke(
                "Which city is hotter today and which is bigger: LA or NY?"
            )
            # GPT-4o response with tool calls

            configurable_model_with_tools.invoke(
                "Which city is hotter today and which is bigger: LA or NY?",
                config={"configurable": {"model": "claude-3-5-sonnet-20240620"}}
            )
            # Claude-3.5 sonnet response with tools

    .. versionadded:: 0.2.7

    .. versionchanged:: 0.2.8

        Support for ``configurable_fields`` and ``config_prefix`` added.

    .. versionchanged:: 0.2.12

        Support for Ollama via langchain-ollama package added
        (langchain_ollama.ChatOllama). Previously,
        the now-deprecated langchain-community version of Ollama was imported
        (langchain_community.chat_models.ChatOllama).

        Support for AWS Bedrock models via the Converse API added
        (model_provider="bedrock_converse").

    .. versionchanged:: 0.3.5

        Out of beta.

    .. versionchanged:: 0.3.19

        Support for Deepseek, IBM, Nvidia, and xAI models added.

    )r#   r     zconfig_prefix=z has been set but no fields are configurable. Set `configurable_fields=(...)` to specify the model params that are configurable.   )
stacklevelr    r#   )default_configr"   r!   )warningswarn_init_chat_model_helperr   r$   r/   r,   r+   r+   r-   r   O   s4    j
)r    c                K  s^  t | |\} }|dkrtd ddlm} |dFd| i|S |dkr5td ddlm} |dFd| i|S |d	krLtd dd
lm} |dFd| i|S |dkrctd ddlm} |dFd| i|S |dkrztd ddl	m
} |dFd| i|S |dkrtd ddlm} |dFd| i|S |dkrtd ddlm}	 |	dFd| i|S |dkrtd ddlm}
 |
dFd| i|S |dkrztd ddlm} W n# ty   ztd ddlm} W n ty   td Y nw Y nw |dFd| i|S |dkrtd dd lm} |dFd| i|S |d!kr,td" dd#lm} |dFd| i|S |d$krDtd% dd&lm} |dFd'| i|S |d(kr\td) dd*lm} |dFd| i|S |d+krttd, dd-lm} |dFd'| i|S |d.krtd, dd/lm} |dFd| i|S |d0krtd dd1l m!} |dFd| i|S |d2krtd3d4d5 dd6l"m#} |dFd| i|S |d7krtd8 dd9l$m%} |dFd| i|S |d:krtd; dd<l&m'} |dFd'| i|S |d=krtd> dd?l(m)} |dFd| i|S |d@krtdA ddBl*m+} |dFd| i|S dC,t-}dD|dE| }t.|)GNopenailangchain_openair   )
ChatOpenAIr#   	anthropiclangchain_anthropic)ChatAnthropicazure_openai)AzureChatOpenAIazure_aiZlangchain_azure_ai)AzureAIChatCompletionsModelcoherelangchain_cohere)
ChatCoheregoogle_vertexailangchain_google_vertexai)ChatVertexAIgoogle_genailangchain_google_genai)ChatGoogleGenerativeAI	fireworkslangchain_fireworks)ChatFireworksollamalangchain_ollama)
ChatOllamaZlangchain_communitytogetherlangchain_together)ChatTogether	mistralailangchain_mistralai)ChatMistralAIhuggingfacelangchain_huggingface)ChatHuggingFaceZmodel_idgroqlangchain_groq)ChatGroqbedrocklangchain_aws)ChatBedrockbedrock_converse)ChatBedrockConversegoogle_anthropic_vertex)ChatAnthropicVertexdeepseeklangchain_deepseekzlangchain-deepseek	pkg_kebab)ChatDeepSeekZnvidialangchain_nvidia_ai_endpoints)
ChatNVIDIAibmlangchain_ibm)ChatWatsonxxailangchain_xai)ChatXAI
perplexitylangchain_perplexity)ChatPerplexityz, zUnsupported model_provider=z".

Supported model providers are: r+   )/_parse_model
_check_pkgr;   r<   r>   r?   rA   Zlangchain_azure_ai.chat_modelsrC   rE   rF   rH   rI   rK   rL   rN   rO   rQ   rR   ImportErrorZlangchain_community.chat_modelsrT   rU   rW   rX   rZ   r[   r]   r^   r`   ra   rc   Z&langchain_google_vertexai.model_gardenre   rg   rj   rk   rl   rn   ro   rq   rr   rt   ru   join_SUPPORTED_PROVIDERS
ValueError)r#   r    r'   r<   r?   rA   rC   rF   rI   rL   rO   rR   rU   rX   r[   r^   ra   rc   re   rj   rl   ro   rr   ru   	supportedmsgr+   r+   r-   r9   T  s   













r9   >   rf   rm   rJ   rb   rM   rV   r\   rY   rd   rB   r=   r:   rS   r_   r@   rp   rD   rG   rs   rP   
model_namec                   s   t  fdddD rdS  drdS  drdS  d	r"d
S  dr)dS  dr0dS  dr7dS  dr>dS  drEdS  drLdS d S )Nc                 3  s    | ]}  |V  qd S r*   )
startswith).0prer~   r+   r-   	<genexpr>  s    z0_attempt_infer_model_provider.<locals>.<genexpr>)zgpt-3zgpt-4Zo1Zo3r:   Zclauder=   commandrD   zaccounts/fireworksrM   geminirG   zamazon.r_   ZmistralrV   rf   Zgrokrp   Zsonarrs   )anyr   r   r+   r   r-   _attempt_infer_model_provider  s*   








r   tuple[str, str]c                 C  s   |s"d| v r"|  dd tv r"|  dd }d|  ddd  } |p't| }|s4d| d}t||dd }| |fS )N:r      z)Unable to infer model provider for model=z), please specify model_provider directly.-_)splitrz   ry   r   r{   replacelower)r#   r    r}   r+   r+   r-   rv     s   
rv   rh   pkgri   Nonec                C  s@   t | s|d ur|n| dd}d|  d| d}t|d S )Nr   r   zUnable to import z&. Please install with `pip install -U `)r   	find_specr   rx   )r   ri   r}   r+   r+   r-   rw     s   
rw   sprefixc                 C  s   |  |r| t|d  } | S r*   )r   len)r   r   r+   r+   r-   _remove_prefix"  s   
r   )
bind_toolswith_structured_outputc                      s  e Zd ZddddddqddZdrddZdsdtddZduddZ	dsdvdd Zedwd"d#Z	e
	dsdxd&d'Ze
	dsdxd(d)Ze
	dsdyd,d-Ze
	dsdzd/d0Z	dsd1d2d{ fd9d:Z	dsd1d2d{ fd;d<Z	dsd1d2d| fd@dAZ	dsd1d2d} fdCdDZe
	dsd~dFdGZe
	dsddIdJZe	dsdKdKdddddddLddXdYZe	dsdKdddddddZdd]dYZe
	dsdKdKdddddddLdd_dYZe
	dsd`dddddddaddedfZddjdkZddodpZ  ZS )r/   Nr   r3   r+   r6   r!   r"   queued_declarative_operationsr6   Optional[dict]r!   r0   r"   r$   r   !Sequence[tuple[str, tuple, dict]]r(   r   c                C  sJ   |pi | _ |dkr|nt|| _|r|ds|d n|| _t|| _d S )Nr   r   )_default_configlist_configurable_fieldsendswith_config_prefix_queued_declarative_operations)selfr6   r!   r"   r   r+   r+   r-   __init__,  s   


z_ConfigurableModel.__init__namer   c                   sj    t v rd fdd}|S jr!  }r!t| r!t| S   d}jr-|d	7 }|d
7 }t|)Nargsr   r'   r(   r/   c                    sJ   t j}| | |f ttjtjt rt jnjj|dS )Nr   )	r   r   appendr/   dictr   
isinstancer   r   )r   r'   r   r   r   r+   r-   queueJ  s   
z-_ConfigurableModel.__getattr__.<locals>.queuez! is not a BaseChatModel attributez, and is not implemented on the default model.)r   r   r'   r   r(   r/   )_DECLARATIVE_METHODSr   _modelhasattrgetattrAttributeError)r   r   r   r#   r}   r+   r   r-   __getattr__C  s   

z_ConfigurableModel.__getattr__configOptional[RunnableConfig]r   c                 C  sL   i | j | |}tdi |}| jD ]\}}}t|||i |}q|S )Nr+   )r   _model_paramsr9   r   r   )r   r   paramsr#   r   r   r'   r+   r+   r-   r   a  s
   z_ConfigurableModel._modelr   c                   sJ   t |} fdd|di  D } jdkr# fdd| D }|S )Nc                   s*   i | ]\}}|  jrt| j|qS r+   )r   r   r   r   kvr   r+   r-   
<dictcomp>j  s    
z4_ConfigurableModel._model_params.<locals>.<dictcomp>configurabler   c                   s    i | ]\}}| j v r||qS r+   )r   r   r   r+   r-   r   p  s    )r   getitemsr   )r   r   model_paramsr+   r   r-   r   h  s   


z _ConfigurableModel._model_paramsr'   c                   s   t di |pi tt |}| dd | D } fdd|di  D |d< tj}|r?|ddd|if ti j	 t
jtrQtjnjj|dS )	z4Bind config to a Runnable, returning a new Runnable.c                 S  s   i | ]\}}|d kr||qS )r   r+   r   r+   r+   r-   r   }  s    z2_ConfigurableModel.with_config.<locals>.<dictcomp>c                   s&   i | ]\}}t |j vr||qS r+   )r   r   r   r   r   r+   r-   r   ~  s
    r   with_configr+   r   r   )r   r   r   r   r   r   r   r   r/   r   r   r   r   )r   r   r'   Zremaining_configr   r+   r   r-   r   u  s,   



z_ConfigurableModel.with_configr   c                 C  s*   ddl m}m} ttt||f tt f S )z%Get the input type for this runnable.r   )ChatPromptValueConcreteStringPromptValue)Zlangchain_core.prompt_valuesr   r   r   r$   r   r   )r   r   r   r+   r+   r-   	InputType  s   
z_ConfigurableModel.InputTypeinputr   c                 K  s   |  |j|fd|i|S Nr   )r   invoker   r   r   r'   r+   r+   r-   r     s   z_ConfigurableModel.invokec                   s$   |  |j|fd|i|I d H S r   )r   ainvoker   r+   r+   r-   r     s   "z_ConfigurableModel.ainvokeOptional[Any]Iterator[Any]c                 k  (    |  |j|fd|i|E d H  d S r   )r   streamr   r+   r+   r-   r        &z_ConfigurableModel.streamAsyncIterator[Any]c                 K 8   |  |j|fd|i|2 z	3 d H W }|V  q6 d S r   )r   astreamr   r   r   r'   xr+   r+   r-   r        (z_ConfigurableModel.astreamF)return_exceptionsinputslist[LanguageModelInput]5Optional[Union[RunnableConfig, list[RunnableConfig]]]r   bool	list[Any]c                  sp   |pd }|d u st |tst|dkr+t |tr|d }| |j|f||d|S t j|f||d|S Nr   r   )r   r   )r   r   r   r   r   batchsuperr   r   r   r   r'   	__class__r+   r-   r     s(   

z_ConfigurableModel.batchc                  s~   |pd }|d u st |tst|dkr/t |tr|d }| |j|f||d|I d H S t j|f||d|I d H S r   )r   r   r   r   r   abatchr   r   r   r+   r-   r     s*   

z_ConfigurableModel.abatchSequence[LanguageModelInput]9Optional[Union[RunnableConfig, Sequence[RunnableConfig]]]+Iterator[tuple[int, Union[Any, Exception]]]c                +  s    |pd }|d u st |tst|dkr4t |tr|d }| tt|j|f||d|E d H  d S t j|f||d|E d H  d S r   )	r   r   r   r   r   r   r   batch_as_completedr   r   r   r+   r-   r     s*   
	z%_ConfigurableModel.batch_as_completedAsyncIterator[tuple[int, Any]]c                 s   |pd }|d u st |tst|dkr<t |tr|d }| tt|j|f||d|2 z	3 d H W }|V  q/6 d S t j|f||d|2 z	3 d H W }|V  qI6 d S r   )	r   r   r   r   r   r   r   abatch_as_completedr   )r   r   r   r   r'   r   r   r+   r-   r      s8   
z&_ConfigurableModel.abatch_as_completedIterator[LanguageModelInput]c                 k  r   r   )r   	transformr   r+   r+   r-   r   A  r   z_ConfigurableModel.transform!AsyncIterator[LanguageModelInput]c                 K r   r   )r   
atransformr   r+   r+   r-   r   J  r   z_ConfigurableModel.atransformT)diffwith_streamed_output_listinclude_namesinclude_typesinclude_tagsexclude_namesexclude_typesexclude_tagsr   Literal[True]r   r   Optional[Sequence[str]]r   r   r   r   r   AsyncIterator[RunLogPatch]c                K  r)   r*   r+   r   r   r   r   r   r   r   r   r   r   r   r'   r+   r+   r-   astream_logT     z_ConfigurableModel.astream_log)r   r   r   r   r   r   r   Literal[False]AsyncIterator[RunLog]c                K  r)   r*   r+   r   r+   r+   r-   r   e  r   8Union[AsyncIterator[RunLogPatch], AsyncIterator[RunLog]]c                K sH   |  |j|f|||||||
|	|d	|2 z	3 d H W }|V  q6 d S )N)	r   r   r   r   r   r   r   r   r   )r   r   )r   r   r   r   r   r   r   r   r   r   r   r'   r   r+   r+   r-   r   v  s$   
v2)versionr   r   r   r   r   r   r   Literal['v1', 'v2']AsyncIterator[StreamEvent]c                K sF   |  |j|f||||||	||d|
2 z	3 d H W }|V  q6 d S )N)r   r   r   r   r   r   r   r   )r   astream_events)r   r   r   r   r   r   r   r   r   r   r'   r   r+   r+   r-   r    s"   

z!_ConfigurableModel.astream_eventstoolsDSequence[Union[dict[str, Any], type[BaseModel], Callable, BaseTool]])Runnable[LanguageModelInput, BaseMessage]c                 K     |  d|fi |S )Nr   r   )r   r  r'   r+   r+   r-   r        z_ConfigurableModel.bind_toolsschemaUnion[dict, type[BaseModel]]4Runnable[LanguageModelInput, Union[dict, BaseModel]]c                 K  r  )Nr   r  )r   r	  r'   r+   r+   r-   r     r  z)_ConfigurableModel.with_structured_output)
r6   r   r!   r0   r"   r$   r   r   r(   r   )r   r$   r(   r   r*   )r   r   r(   r   )r   r   r(   r   )r   r   r'   r   r(   r/   )r(   r   )r   r   r   r   r'   r   r(   r   )r   r   r   r   r'   r   r(   r   )r   r   r   r   r'   r   r(   r   )
r   r   r   r   r   r   r'   r   r(   r   )
r   r   r   r   r   r   r'   r   r(   r   )
r   r   r   r   r   r   r'   r   r(   r   )r   r   r   r   r'   r   r(   r   )r   r   r   r   r'   r   r(   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r'   r   r(   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r'   r   r(   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r'   r   r(   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r'   r   r(   r  )r  r  r'   r   r(   r  )r	  r
  r'   r   r(   r  )__name__
__module____qualname__r   r   r   r   r   propertyr   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r   r   __classcell__r+   r+   r   r-   r/   +  s    

  !	
)r#   r$   r    r%   r!   r&   r"   r%   r'   r   r(   r   r*   )r#   r&   r    r%   r!   r&   r"   r%   r'   r   r(   r/   )r#   r%   r    r%   r!   r0   r"   r%   r'   r   r(   r/   )r#   r%   r    r%   r!   r1   r"   r%   r'   r   r(   r2   )r#   r$   r    r%   r'   r   r(   r   )r~   r$   r(   r%   )r#   r$   r    r%   r(   r   )r   r$   ri   r%   r(   r   )r   r$   r   r$   r(   r$   )5
__future__r   r7   collections.abcr   r   r   	importlibr   typingr   r   r	   r
   r   r   r   Zlangchain_core.language_modelsr   r   r   Z*langchain_core.language_models.chat_modelsr   r   Zlangchain_core.messagesr   r   Zlangchain_core.runnablesr   r   r   Zlangchain_core.runnables.schemar   Zlangchain_core.toolsr   Zlangchain_core.tracersr   r   Zpydanticr   Ztyping_extensionsr   r   __all__r   r9   rz   r   rv   rw   r   r   r/   r+   r+   r+   r-   <module>   sh    $



  
 


	