Home / Function/ _model() — langchain Function Reference

_model() — langchain Function Reference

Architecture documentation for the _model() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  6c53e804_ca90_2550_60fe_a652f0346a3f["_model()"]
  3eb71182_6a88_2f5e_c4e9_e98a7648f40b["_ConfigurableModel"]
  6c53e804_ca90_2550_60fe_a652f0346a3f -->|defined in| 3eb71182_6a88_2f5e_c4e9_e98a7648f40b
  57dd2069_a13e_bbba_e3dd_0a16b9d8d5c2["__getattr__()"]
  57dd2069_a13e_bbba_e3dd_0a16b9d8d5c2 -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  0357ecb4_528d_27b1_f829_9d5043640a1c["invoke()"]
  0357ecb4_528d_27b1_f829_9d5043640a1c -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  b3009ee8_747a_f49b_1b3c_23eb3507b24b["ainvoke()"]
  b3009ee8_747a_f49b_1b3c_23eb3507b24b -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  e81ca58b_c6bf_3870_b0c0_15ce8990a735["stream()"]
  e81ca58b_c6bf_3870_b0c0_15ce8990a735 -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  3588ef38_16c4_8f64_2d9d_b187e5f81674["astream()"]
  3588ef38_16c4_8f64_2d9d_b187e5f81674 -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  bf8aca61_d2e1_b225_5502_4c82fc944f4d["batch()"]
  bf8aca61_d2e1_b225_5502_4c82fc944f4d -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  4d113b85_75bd_bc52_0d5a_0b06c1dea95a["abatch()"]
  4d113b85_75bd_bc52_0d5a_0b06c1dea95a -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  bd823327_5cef_68bc_ca22_5fd0f9f238c1["batch_as_completed()"]
  bd823327_5cef_68bc_ca22_5fd0f9f238c1 -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  808bf383_2201_305d_f8d0_5c21d0b28846["abatch_as_completed()"]
  808bf383_2201_305d_f8d0_5c21d0b28846 -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  f037c4f3_02eb_b4fc_3b0c_78528487ac7e["transform()"]
  f037c4f3_02eb_b4fc_3b0c_78528487ac7e -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  9983f28f_a118_0caa_9e99_eebadfdf8ddb["atransform()"]
  9983f28f_a118_0caa_9e99_eebadfdf8ddb -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  ee30ca64_dce9_e4d3_a25e_158595883091["astream_log()"]
  ee30ca64_dce9_e4d3_a25e_158595883091 -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  77bddd28_1dc0_e3a3_4b1b_ca3e91f07585["astream_events()"]
  77bddd28_1dc0_e3a3_4b1b_ca3e91f07585 -->|calls| 6c53e804_ca90_2550_60fe_a652f0346a3f
  style 6c53e804_ca90_2550_60fe_a652f0346a3f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/chat_models/base.py lines 650–655

    def _model(self, config: RunnableConfig | None = None) -> Runnable[Any, Any]:
        params = {**self._default_config, **self._model_params(config)}
        model = _init_chat_model_helper(**params)
        for name, args, kwargs in self._queued_declarative_operations:
            model = getattr(model, name)(*args, **kwargs)
        return model

Subdomains

Frequently Asked Questions

What does _model() do?
_model() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/chat_models/base.py.
Where is _model() defined?
_model() is defined in libs/langchain_v1/langchain/chat_models/base.py at line 650.
What does _model() call?
_model() calls 2 function(s): _init_chat_model_helper, _model_params.
What calls _model()?
_model() is called by 13 function(s): __getattr__, abatch, abatch_as_completed, ainvoke, astream, astream_events, astream_log, atransform, and 5 more.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free