
    KKi                    :   S SK Jr  S SKrS SKJrJrJrJr  S SKJ	r	  S SK
JrJrJrJrJr  S SKJrJrJr  S SKJrJr  S SKJrJr  S S	KJrJrJr  S S
KJr  S SK J!r!  S SK"J#r#J$r$  S SK%J&r&  S SK'J(r(  / SQr)\SSSS.           S S jj5       r*\ S!SSSS.           S"S jjj5       r*\ S!SSSS.           S#S jjj5       r* S!SSSS.           S$S jjjr*SS.       S%S jjr+1 Skr,S&S jr-S'S jr.SS.S(S jjr/Sr0 " S S\\\4   5      r1g))    )annotationsN)AsyncIteratorCallableIteratorSequence)util)AnyLiteral	TypeAliascastoverload)BaseChatModelLanguageModelInputSimpleChatModel)agenerate_from_streamgenerate_from_stream)	AIMessage
AnyMessage)RunnableRunnableConfigensure_config)StreamEvent)BaseTool)RunLogRunLogPatch)	BaseModel)override)r   r   r   r   init_chat_model)model_providerconfigurable_fieldsconfig_prefixc                   g N modelr   r    r!   kwargss        d/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/langchain_classic/chat_models/base.pyr   r   #   s         _ConfigurableModelc                   g r#   r$   r%   s        r(   r   r   .        r)   .c                   g r#   r$   r%   s        r(   r   r   9   r,   r)   c                  U (       d	  U(       d  SnU=(       d    SnU(       a!  U(       d  [         R                  " SU< S3SS9  U(       d  [        [        SU 5      4SU0UD6$ U (       a  XS	'   U(       a  XS'   [	        UUUS
9$ )u .  Initialize a chat model from any supported provider using a unified interface.

**Two main use cases:**

1. **Fixed model** – specify the model upfront and get back a ready-to-use chat
    model.
2. **Configurable model** – choose to specify parameters (including model name) at
    runtime via `config`. Makes it easy to switch between models/providers without
    changing your code

!!! note
    Requires the integration package for the chosen model provider to be installed.

    See the `model_provider` parameter below for specific package names
    (e.g., `pip install langchain-openai`).

    Refer to the [provider integration's API reference](https://docs.langchain.com/oss/python/integrations/providers)
    for supported model parameters to use as `**kwargs`.

Args:
    model: The name or ID of the model, e.g. `'o3-mini'`, `'claude-sonnet-4-5-20250929'`.

        You can also specify model and model provider in a single argument using
        `'{model_provider}:{model}'` format, e.g. `'openai:o1'`.

        Will attempt to infer `model_provider` from model if not specified.

        The following providers will be inferred based on these model prefixes:

        - `gpt-...` | `o1...` | `o3...`       -> `openai`
        - `claude...`                         -> `anthropic`
        - `amazon...`                         -> `bedrock`
        - `gemini...`                         -> `google_vertexai`
        - `command...`                        -> `cohere`
        - `accounts/fireworks...`             -> `fireworks`
        - `mistral...`                        -> `mistralai`
        - `deepseek...`                       -> `deepseek`
        - `grok...`                           -> `xai`
        - `sonar...`                          -> `perplexity`
    model_provider: The model provider if not specified as part of the model arg
        (see above).

        Supported `model_provider` values and the corresponding integration package
        are:

        - `openai`                  -> [`langchain-openai`](https://docs.langchain.com/oss/python/integrations/providers/openai)
        - `anthropic`               -> [`langchain-anthropic`](https://docs.langchain.com/oss/python/integrations/providers/anthropic)
        - `azure_openai`            -> [`langchain-openai`](https://docs.langchain.com/oss/python/integrations/providers/openai)
        - `azure_ai`                -> [`langchain-azure-ai`](https://docs.langchain.com/oss/python/integrations/providers/microsoft)
        - `google_vertexai`         -> [`langchain-google-vertexai`](https://docs.langchain.com/oss/python/integrations/providers/google)
        - `google_genai`            -> [`langchain-google-genai`](https://docs.langchain.com/oss/python/integrations/providers/google)
        - `bedrock`                 -> [`langchain-aws`](https://docs.langchain.com/oss/python/integrations/providers/aws)
        - `bedrock_converse`        -> [`langchain-aws`](https://docs.langchain.com/oss/python/integrations/providers/aws)
        - `cohere`                  -> [`langchain-cohere`](https://docs.langchain.com/oss/python/integrations/providers/cohere)
        - `fireworks`               -> [`langchain-fireworks`](https://docs.langchain.com/oss/python/integrations/providers/fireworks)
        - `together`                -> [`langchain-together`](https://docs.langchain.com/oss/python/integrations/providers/together)
        - `mistralai`               -> [`langchain-mistralai`](https://docs.langchain.com/oss/python/integrations/providers/mistralai)
        - `huggingface`             -> [`langchain-huggingface`](https://docs.langchain.com/oss/python/integrations/providers/huggingface)
        - `groq`                    -> [`langchain-groq`](https://docs.langchain.com/oss/python/integrations/providers/groq)
        - `ollama`                  -> [`langchain-ollama`](https://docs.langchain.com/oss/python/integrations/providers/ollama)
        - `google_anthropic_vertex` -> [`langchain-google-vertexai`](https://docs.langchain.com/oss/python/integrations/providers/google)
        - `deepseek`                -> [`langchain-deepseek`](https://docs.langchain.com/oss/python/integrations/providers/deepseek)
        - `ibm`                     -> [`langchain-ibm`](https://docs.langchain.com/oss/python/integrations/providers/ibm)
        - `nvidia`                  -> [`langchain-nvidia-ai-endpoints`](https://docs.langchain.com/oss/python/integrations/providers/nvidia)
        - `xai`                     -> [`langchain-xai`](https://docs.langchain.com/oss/python/integrations/providers/xai)
        - `perplexity`              -> [`langchain-perplexity`](https://docs.langchain.com/oss/python/integrations/providers/perplexity)
    configurable_fields: Which model parameters are configurable at runtime:

        - `None`: No configurable fields (i.e., a fixed model).
        - `'any'`: All fields are configurable. **See security note below.**
        - `list[str] | Tuple[str, ...]`: Specified fields are configurable.

        Fields are assumed to have `config_prefix` stripped if a `config_prefix` is
        specified.

        If `model` is specified, then defaults to `None`.

        If `model` is not specified, then defaults to `("model", "model_provider")`.

        !!! warning "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: Optional prefix for configuration keys.

        Useful when you have multiple configurable models in the same application.

        If `'config_prefix'` is a non-empty string then `model` will be configurable
        at runtime via the `config["configurable"]["{config_prefix}_{param}"]` keys.
        See examples below.

        If `'config_prefix'` is an empty string then model will be configurable via
        `config["configurable"]["{param}"]`.
    **kwargs: Additional model-specific keyword args to pass to the underlying
        chat model's `__init__` method. Common parameters include:

        - `temperature`: Model temperature for controlling randomness.
        - `max_tokens`: Maximum number of output tokens.
        - `timeout`: Maximum time (in seconds) to wait for a response.
        - `max_retries`: Maximum number of retry attempts for failed requests.
        - `base_url`: Custom API endpoint URL.
        - `rate_limiter`: A
            [`BaseRateLimiter`][langchain_core.rate_limiters.BaseRateLimiter]
            instance to control request rate.

        Refer to the specific model provider's
        [integration reference](https://reference.langchain.com/python/integrations/)
        for all available parameters.

Returns:
    A [`BaseChatModel`][langchain_core.language_models.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.

???+ example "Initialize a non-configurable model"

    ```python
    # pip install langchain langchain-openai langchain-anthropic langchain-google-vertexai

    from langchain_classic.chat_models import init_chat_model

    o3_mini = init_chat_model("openai:o3-mini", temperature=0)
    claude_sonnet = init_chat_model("anthropic:claude-sonnet-4-5-20250929", temperature=0)
    gemini_2-5_flash = init_chat_model(
        "google_vertexai:gemini-2.5-flash", temperature=0
    )

    o3_mini.invoke("what's your name")
    claude_sonnet.invoke("what's your name")
    gemini_2-5_flash.invoke("what's your name")
    ```

??? example "Partially configurable model with no default"

    ```python
    # pip install langchain langchain-openai langchain-anthropic

    from langchain_classic.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"}}
    )
    # Use GPT-4o to generate the response

    configurable_model.invoke(
        "what's your name",
        config={"configurable": {"model": "claude-sonnet-4-5-20250929"}},
    )
    ```

??? example "Fully configurable model with a default"

    ```python
    # pip install langchain langchain-openai langchain-anthropic

    from langchain_classic.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 (as set in default)

    configurable_model_with_default.invoke(
        "what's your name",
        config={
            "configurable": {
                "foo_model": "anthropic:claude-sonnet-4-5-20250929",
                "foo_temperature": 0.6,
            }
        },
    )
    # Override default to use Sonnet 4.5 with temperature 0.6 to generate response
    ```

??? example "Bind tools to a configurable model"

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

    ```python
    # pip install langchain langchain-openai langchain-anthropic

    from langchain_classic.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?"
    )
    # Use GPT-4o

    configurable_model_with_tools.invoke(
        "Which city is hotter today and which is bigger: LA or NY?",
        config={"configurable": {"model": "claude-sonnet-4-5-20250929"}},
    )
    # Use Sonnet 4.5
    ```

!!! warning "Behavior changed in `langchain` 0.2.8"

    Support for `configurable_fields` and `config_prefix` added.

!!! warning "Behavior changed in `langchain` 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"`).

!!! warning "Behavior changed in `langchain` 0.3.5"

    Out of beta.

!!! warning "Behavior changed in `langchain` 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.   )
stacklevelstrr   r&   )default_configr!   r    )warningswarn_init_chat_model_helperr   r*   r%   s        r(   r   r   G   s    b ,9!'RM0}   		
 &
)
 
 	

 w#1 #/ r)   )r   c                  [        X5      u  pUS:X  a  [        S5        SSKJn  U" SISU 0UD6$ US:X  a  [        S5        SSKJn  U" SISU 0UD6$ US	:X  a  [        S5        SS
KJn  U" SISU 0UD6$ US:X  a  [        S5        SSKJn  U" SISU 0UD6$ US:X  a  [        S5        SSK	J
n  U" SISU 0UD6$ US:X  a  [        S5        SSKJn  U" SISU 0UD6$ US:X  a  [        S5        SSKJn	  U	" SISU 0UD6$ US:X  a  [        S5        SSKJn
  U
" SISU 0UD6$ US:X  a   [        S5        SSKJn  W" SISU 0UD6$ US:X  a  [        S5        SS KJn  U" SISU 0UD6$ US!:X  a  [        S"5        SS#KJn  U" SISU 0UD6$ US$:X  a%  [        S%5        SS&KJn  UR6                  " SIS'U 0UD6$ US(:X  a  [        S)5        SS*KJn  U" SISU 0UD6$ US+:X  a  [        S,5        SS-KJn  U" SIS'U 0UD6$ US.:X  a  [        S,5        SS/KJ n  U" SISU 0UD6$ US0:X  a  [        S5        SS1K!J"n  U" SISU 0UD6$ US2:X  a  [        S3S4S59  SS6K#J$n  U" SISU 0UD6$ US7:X  a  [        S85        SS9K%J&n  U" SISU 0UD6$ US::X  a  [        S;5        SS<K'J(n  U" SIS'U 0UD6$ US=:X  a  [        S>5        SS?K)J*n  U" SISU 0UD6$ US@:X  a  [        SA5        SSBK+J,n  U" SISU 0UD6$ USC:X  a  [        SD5        SSEK-J.n  U" SISU 0UD6$ SFR_                  [`        5      nSGU< SHU 3n[c        U5      e! [&         a3     [        S5        SSKJn   GN! [&         a    [        S5          GN!f = ff = f)JNopenailangchain_openair   )
ChatOpenAIr&   	anthropiclangchain_anthropic)ChatAnthropicazure_openai)AzureChatOpenAIazure_ai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)
ChatOllamalangchain_communitytogetherlangchain_together)ChatTogether	mistralailangchain_mistralai)ChatMistralAIhuggingfacelangchain_huggingface)ChatHuggingFacemodel_idgroqlangchain_groq)ChatGroqbedrocklangchain_aws)ChatBedrockbedrock_converse)ChatBedrockConversegoogle_anthropic_vertex)ChatAnthropicVertexdeepseeklangchain_deepseekzlangchain-deepseek	pkg_kebab)ChatDeepSeeknvidialangchain_nvidia_ai_endpoints)
ChatNVIDIAibmlangchain_ibm)ChatWatsonxxailangchain_xai)ChatXAI
perplexitylangchain_perplexity)ChatPerplexityupstagelangchain_upstage)ChatUpstage, zUnsupported model_provider=z".

Supported model providers are: r$   )2_parse_model
_check_pkgr9   r:   r<   r=   r?   langchain_azure_ai.chat_modelsrB   rD   rE   rG   rH   rJ   rK   rM   rN   rP   rQ   ImportErrorlangchain_community.chat_modelsrT   rU   rW   rX   rZ   r[   from_model_idr^   r_   ra   rb   rd   &langchain_google_vertexai.model_gardenrf   rh   rk   rm   rn   rp   rq   rs   rt   rv   rw   ry   rz   join_SUPPORTED_PROVIDERS
ValueError)r&   r   r'   r:   r=   r?   rB   rE   rH   rK   rN   rQ   rU   rX   r[   r_   rb   rd   rf   rk   rn   rq   rt   rw   rz   	supportedmsgs                              r(   r6   r6   t  s    )?E!%&/0000$()5353F33'%&45U5f55#'(N*AA&AA!%&/0000**./:2%2622'+,A%<E<V<<$()5353F33!	/)*3 0000#'(32%2622$()5353F33&*+9,,FeFvFF#$+.e.v.."?#- 4E4V44++?#5"99&9922./N"99&99#'3GH32%2622!23<0000?#-4E4V44?#)-U-f--%)*74E4V44"&'111&11		./I
&~''KI;W  S/g  	//01FF / -../	/s*   L 
M"L66MMMM>   ro   rr   r]   rC   rO   r8   r`   rx   r@   rg   rS   r;   rL   rV   ru   rY   r>   rI   rF   rc   re   c                T  ^ U R                  5       m[        U4S jS 5       5      (       a  gTR                  S5      (       a  gTR                  S5      (       a  gU R                  S5      (       a  g	TR                  S
5      (       a  gU R                  S5      (       d  TR                  S5      (       a  gTR                  S5      (       a  gTR                  S5      (       a  gTR                  S5      (       a  gTR                  S5      (       a  gTR                  S5      (       a  gg)zAttempt to infer model provider from model name.

Args:
    model_name: The name of the model to infer provider for.

Returns:
    The inferred provider name, or `None` if no provider could be inferred.
c              3  F   >#    U  H  nTR                  U5      v   M     g 7fr#   )
startswith).0premodel_lowers     r(   	<genexpr>0_attempt_infer_model_provider.<locals>.<genexpr>"  s*      	
C 	s##
s   !)zgpt-o1o3chatgptztext-davincir8   clauder;   commandrC   zaccounts/fireworksrL   geminirF   zamazon.)z
anthropic.zmeta.r`   )mistralmixtralrV   rg   grokrr   sonarru   solarrx   N)loweranyr   )
model_namer   s    @r(   _attempt_infer_model_providerr     s.    ""$K  	
	 	 	  h'' i(( 122 h''  Y'';+A+A, ,  455 j)) f%% g&& g&&r)   c                p   U(       d?  SU ;   a9  U R                  SS5      u  p#U[        ;   a  UnUn O[        U5      nU(       a  UnUn U=(       d    [        U 5      nU(       d3  SR                  [	        [        5      5      nSU < SU S3n[        U5      eUR                  SS5      R                  5       nX4$ )	z?Parse model name and provider, inferring provider if necessary.:   r{   z)Unable to infer model provider for model=zB. Please specify 'model_provider' directly.

Supported providers: ze

For help with specific providers, see: https://docs.langchain.com/oss/python/integrations/providers-_)splitr   r   r   sortedr   replacer   )r&   r   prefixsuffixinferredsupported_listr   s          r(   r|   r|   [  s    cUlS!,))#NE4V<H!)#K'DU'KN6*>#?@8% :$$2#3 4KL 	 o $++C5;;=N  r)   ri   c                   [         R                  " U 5      (       d+  Ub  UOU R                  SS5      nSU  SU S3n[        U5      eg )Nr   r   zUnable to import z&. Please install with `pip install -U `)r   	find_specr   r   )pkgrj   r   s      r(   r}   r}   y  sS    >>#!*!6ICKKS<Q	u$J9+UVW 	 # r)   )
bind_toolswith_structured_outputc                    ^  \ rS rSrSSSSS.         S%S jjrS&S jrS'S(S	 jjrS)S
 jr S'     S*S jjr\	\
S+S j5       5       r\
 S'       S,S jj5       r\
 S'       S,S jj5       r\
 S'       S-S jj5       r\
 S'       S.S jj5       r S'SS.         S/U 4S jjjjr S'SS.         S/U 4S jjjjr S'SS.         S0U 4S jjjjr S'SS.         S1U 4S jjjjr\
 S'       S2S jj5       r\
 S'       S3S jj5       r\ S'SSSSSSSSS.                       S4S jjj5       r\ S'SSSSSSSS.                       S5S jjj5       r\
 S'SSSSSSSSS.                       S6S jjj5       r\
 S'SSSSSSSS .                     S7S! jjj5       r      S8S" jr      S9S# jrS$rU =r$ ):r*   i  Nr   r/   r$   r3   r    r!   queued_declarative_operationsc                   U=(       d    0 U l         US:X  a  UO
[        U5      U l        U(       a  UR                  S5      (       d  US-   OUU l        [        U5      U l        g )Nr   r   )_default_configlist_configurable_fieldsendswith_config_prefix_queued_declarative_operations)selfr3   r    r!   r   s        r(   __init___ConfigurableModel.__init__  sp     &4%9r #e+  )* 	! ]%;%;C%@%@ C 	
 NR)N
+r)   c                  ^ ^ T[         ;   a  SUU 4S jjnU$ T R                  (       a4  T R                  5       =n(       a  [        UT5      (       a  [	        UT5      $ T S3nT R                  (       a  US-  nUS-  n[        U5      e)Nc                 "  > [        TR                  5      nUR                  TX45        [        [	        TR
                  5      [        TR                  [         5      (       a  [        TR                  5      OTR                  TR                  US9$ )Nr   )	r   r   appendr*   dictr   
isinstancer   r   )argsr'   r   namer   s      r(   queue-_ConfigurableModel.__getattr__.<locals>.queue  s    04771- .44dD5IJ)#'(<(<#=!$";";TBB )-T-F-F(G22"&"5"52O r)   z! is not a BaseChatModel attributez, and is not implemented on the default model.)r   r	   r'   r	   returnr*   )_DECLARATIVE_METHODSr   _modelhasattrgetattrAttributeError)r   r   r   r&   r   s   ``   r(   __getattr___ConfigurableModel.__getattr__  s    ''  Ldkkm%;U%;PTAUAU5$''78AACs
S!!r)   c                    0 U R                   EU R                  U5      En[        S0 UD6nU R                   H  u  pEn[	        X45      " U0 UD6nM     U$ )Nr$   )r   _model_paramsr6   r   r   )r   configparamsr&   r   r   r'   s          r(   r   _ConfigurableModel._model  s^    GD((GD,>,>v,FG'1&1"&"E"EDE($9&9E #Fr)   c                   [        U5      nUR                  S0 5      R                  5        VVs0 s HC  u  p#UR                  U R                  5      (       d  M'  UR                  U R                  5      U_ME     nnnU R                  S:w  a5  UR                  5        VVs0 s H  u  p#X R                  ;   d  M  X#_M     nnnU$ s  snnf s  snnf )Nconfigurabler   )r   getitemsr   r   removeprefixr   )r   r   kvmodel_paramss        r(   r    _ConfigurableModel._model_params  s    v& 

>26<<>
>||D//0 3ANN4../2> 	 

 $$-!-!3!3!5!5>W>W9W!5   
s   &C CC	8C	c                   [        S0 U=(       d    0 D[        SU5      D6nU R                  U5      nUR                  5        VVs0 s H  u  pEUS:w  d  M  XE_M     nnnUR	                  S0 5      R                  5        VVs0 s H(  u  pEUR                  U R                  5      U;  d  M&  XE_M*     snnUS'   [        U R                  5      nU(       a  UR                  SSSU045        [        0 U R                  EUE[        U R                  [        5      (       a  [        U R                  5      OU R                  U R                  US9$ s  snnf s  snnf )z8Bind config to a `Runnable`, returning a new `Runnable`.r   r   with_configr$   r   r   )r   r   r   r   r   r   r   r   r   r   r*   r   r   r   )r   r   r'   r   r   r   remaining_configr   s           r(   r   _ConfigurableModel.with_config  sM     S6<RSD9I64RS))&1-3\\^S^TQqN?RDAD^S 

>26<<>,
>~~d112,F AD>,
(
 )-T-P-P(Q%)00!/0 "Cd22ClC$33T:: !%T%>%> ?**--*G
 	
 T,
s   EE%E*Ec                F    SSK JnJn  [        U-  U-  [        [
           -  $ )z'Get the input type for this `Runnable`.r   )ChatPromptValueConcreteStringPromptValue)langchain_core.prompt_valuesr   r   r2   r   r   )r   r   r   s      r(   	InputType_ConfigurableModel.InputType  s%    	
 &&)@@4
CSSSr)   c                J    U R                  U5      R                  " U4SU0UD6$ Nr   )r   invoker   inputr   r'   s       r(   r   _ConfigurableModel.invoke  s(     {{6"))%II&IIr)   c                f   #    U R                  U5      R                  " U4SU0UD6I S h  vN $  N7fr   )r   ainvoker   s       r(   r   _ConfigurableModel.ainvoke  s1      [[(00PvPPPPPs   (1/1c              +  h   #    U R                  U5      R                  " U4SU0UD6 S h  vN   g  N7fr   )r   streamr   s       r(   r   _ConfigurableModel.stream  s.      ;;v&--eMFMfMMM   (202c               z   #    U R                  U5      R                  " U4SU0UD6  S h  vN nU7v   M   N
 g 7fr   )r   astreamr   r   r   r'   xs        r(   r   _ConfigurableModel.astream  s<      {{6*225RR6R 	!G	R   %;979;9;F)return_exceptionsc                 > U=(       d    S nUb$  [        U[        5      (       d  [        U5      S::  a?  [        U[        5      (       a  US   nU R	                  U5      R
                  " U4UUS.UD6$ [        TU ]  " U4UUS.UD6$ Nr   r   r   r   )r   r   lenr   r   batchsuperr   inputsr   r   r'   	__class__s        r(   r   _ConfigurableModel.batch"  s     4>Z55V9I&$'';;v&,,"3 	  w}
/
 	
 	
r)   c               >  >#    U=(       d    S nUb$  [        U[        5      (       d  [        U5      S::  aG  [        U[        5      (       a  US   nU R	                  U5      R
                  " U4UUS.UD6I S h  vN $ [        TU ]  " U4UUS.UD6I S h  vN $  N  N7fr   )r   r   r   r   r   abatchr  r  s        r(   r  _ConfigurableModel.abatch>  s      4>Z55V9I&$''V,33"3 	   W^
/
 	
 
 	

s$   A5B8B9BBBBc             +  V  >#    U=(       d    S nUb$  [        U[        5      (       d  [        U5      S::  aR  [        U[        5      (       a  US   nU R	                  [        SU5      5      R                  " U4UUS.UD6 S h  vN   g [        TU ]  " U4UUS.UD6 S h  vN   g  N" N7fNr   r   r   r   )r   r   r   r   r   r   batch_as_completedr  r  s        r(   r  %_ConfigurableModel.batch_as_completedZ  s      4>Z55V9I&$''{{4(8&#ABUU"3 	   w1"3 	  s$   A?B)B%B)B' B)'B)c              z  >#    U=(       d    S nUb$  [        U[        5      (       d  [        U5      S::  aY  [        U[        5      (       a  US   nU R	                  [        SU5      5      R                  " U4UUS.UD6  S h  vN nU7v   M  [        TU ]  " U4UUS.UD6  S h  vN nU7v   M   N/
 g  N
 g 7fr
  )r   r   r   r   r   r   abatch_as_completedr  )r   r  r   r   r'   r   r  s         r(   r  &_ConfigurableModel.abatch_as_completedw  s      4>Z55V9I&$'';;%v.!!"  "3  a  !76"3 	 a %  sN   A<B;?B5B3B5B;#B9'B7(B9+B;3B55B;7B99B;c              +  h   #    U R                  U5      R                  " U4SU0UD6 S h  vN   g  N7fr   )r   	transformr   s       r(   r  _ConfigurableModel.transform  s.      ;;v&00PvPPPPr   c               z   #    U R                  U5      R                  " U4SU0UD6  S h  vN nU7v   M   N
 g 7fr   )r   
atransformr   s        r(   r  _ConfigurableModel.atransform  s<      {{6*55eUFUfU 	!G	Ur   T)diffwith_streamed_output_listinclude_namesinclude_typesinclude_tagsexclude_namesexclude_typesexclude_tagsc                   g r#   r$   r   r   r   r  r  r  r  r  r  r  r  r'   s               r(   astream_log_ConfigurableModel.astream_log  s     &)r)   )r  r  r  r  r  r  r  c                   g r#   r$   r  s               r(   r   r!    s     !$r)   c                 #    U R                  U5      R                  " U4UUUUUUU
U	US.	UD6  S h  vN nU7v   M   N
 g 7f)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   s                r(   r   r!    sc       {{6*66
&?''%%''
 
 	! G	 
s#   -AA?AAAAv2)versionr  r  r  r  r  r  c                 #    U R                  U5      R                  " U4UUUUUU	UUS.U
D6  S h  vN nU7v   M   N
 g 7f)N)r   r%  r  r  r  r  r  r  )r   astream_events)r   r   r   r%  r  r  r  r  r  r  r'   r   s               r(   r'  !_ConfigurableModel.astream_events  s`      {{6*99
''%%''
 
 	! G	 
s#   ,AA >A AA  Ac                2    U R                  S5      " U40 UD6$ )Nr   r   )r   toolsr'   s      r(   r   _ConfigurableModel.bind_tools
  s    
 -e>v>>r)   c                2    U R                  S5      " U40 UD6$ )Nr   r*  )r   schemar'   s      r(   r   )_ConfigurableModel.with_structured_output  s     
  89&KFKKr)   )r   r   r   r   )
r3   zdict | Noner    ,Literal['any'] | list[str] | tuple[str, ...]r!   r2   r   z!Sequence[tuple[str, tuple, dict]]r   None)r   r2   r   r	   r#   )r   RunnableConfig | Noner   r   )r   r2  r   r   )r   r2  r'   r	   r   r*   )r   r   )r   r   r   r2  r'   r	   r   r	   )r   r   r   r2  r'   
Any | Noner   Iterator[Any])r   r   r   r2  r'   r3  r   AsyncIterator[Any])
r  zlist[LanguageModelInput]r   z,RunnableConfig | list[RunnableConfig] | Noner   boolr'   r3  r   z	list[Any])
r  Sequence[LanguageModelInput]r   0RunnableConfig | Sequence[RunnableConfig] | Noner   r6  r'   r	   r   z%Iterator[tuple[int, Any | Exception]])
r  r7  r   r8  r   r6  r'   r	   r   zAsyncIterator[tuple[int, Any]])r   zIterator[LanguageModelInput]r   r2  r'   r3  r   r4  )r   z!AsyncIterator[LanguageModelInput]r   r2  r'   r3  r   r5  )r   r	   r   r2  r  zLiteral[True]r  r6  r  Sequence[str] | Noner  r9  r  r9  r  r9  r  r9  r  r9  r'   r	   r   zAsyncIterator[RunLogPatch])r   r	   r   r2  r  zLiteral[False]r  r6  r  r9  r  r9  r  r9  r  r9  r  r9  r  r9  r'   r	   r   zAsyncIterator[RunLog])r   r	   r   r2  r  r6  r  r6  r  r9  r  r9  r  r9  r  r9  r  r9  r  r9  r'   r	   r   z2AsyncIterator[RunLogPatch] | AsyncIterator[RunLog])r   r	   r   r2  r%  zLiteral['v1', 'v2']r  r9  r  r9  r  r9  r  r9  r  r9  r  r9  r'   r	   r   zAsyncIterator[StreamEvent])r+  z@Sequence[dict[str, Any] | type[BaseModel] | Callable | BaseTool]r'   r	   r   z'Runnable[LanguageModelInput, AIMessage])r.  zdict | type[BaseModel]r'   r	   r   z.Runnable[LanguageModelInput, dict | BaseModel])__name__
__module____qualname____firstlineno__r   r   r   r   r   propertyr   r   r   r   r   r   r   r  r  r  r  r  r   r   r'  r   r   __static_attributes____classcell__)r  s   @r(   r*   r*     sT    '+LQKM
 $
 J	

 
 (I
 

."< )-
%
 
 
	
@ 
T  
T  )-J!J &J 	J
 
J J  )-Q!Q &Q 	Q
 
Q Q  )-N!N &N 	N
 
N N  )-! & 	
 
  @D

 #(
(
 =

  
 
 

 
> @D

 #(
(
 =

  
 
 

 
> DH
 #(, A
    
/ @ DH
 #(, A
    
( B  )-Q+Q &Q 	Q
 
Q Q  )-0 & 	
 
   )-)
 #*..2.2-1.2.2-1)) &)
 ) $() ,) ,) +) ,) ,) +) ) 
$) )   )-$ +/.2.2-1.2.2-1$$ &$
 $ $($ ,$ ,$ +$ ,$ ,$ +$ $ 
$ $   )-
 *..2.2-1.2.2-1 &
  $( , , + , , +  
< <  )-
 (,.2.2-1.2.2-1 &
 % , , + , , +  
$ :?O? ? 
1	?L&L L 
8	L Lr)   )r&   r2   r   
str | Noner    r1  r!   rA  r'   r	   r   r   r#   )r&   r1  r   rA  r    r1  r!   rA  r'   r	   r   r*   )r&   rA  r   rA  r    r0  r!   rA  r'   r	   r   r*   )r&   rA  r   rA  r    z3Literal['any'] | list[str] | tuple[str, ...] | Noner!   rA  r'   r	   r   z"BaseChatModel | _ConfigurableModel)r&   r2   r   rA  r'   r	   r   r   )r   r2   r   rA  )r&   r2   r   rA  r   ztuple[str, str])r   r2   rj   rA  r   r1  )2
__future__r   r4   collections.abcr   r   r   r   	importlibr   typingr	   r
   r   r   r   langchain_core.language_modelsr   r   r   *langchain_core.language_models.chat_modelsr   r   langchain_core.messagesr   r   langchain_core.runnablesr   r   r   langchain_core.runnables.schemar   langchain_core.toolsr   langchain_core.tracersr   r   pydanticr   typing_extensionsr   __all__r   r6   r   r   r|   r}   r   r*   r$   r)   r(   <module>rP     s<   "  G G  : : 
 : L L 7 ) 6  & 
 "& $ $  	
    
 
 "& $ $  	
    
 
 "&HK $  F	
    
 j "&OS $jj j M	j
 j j (j`	 "&FF F 	F
 FR 2BJ!< 59  @ RL"4c"9: RLr)   