Home / Class/ RunnableBindingBase Class — langchain Architecture

RunnableBindingBase Class — langchain Architecture

Architecture documentation for the RunnableBindingBase class in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  fdec1b0d_a114_c2f1_9959_4128de6c9809["RunnableBindingBase"]
  5f3c1f1c_6f8a_e293_7cb5_97c21b4bf214["base.py"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|defined in| 5f3c1f1c_6f8a_e293_7cb5_97c21b4bf214
  4e5af940_4e0a_f903_f8b7_85751445eef8["__init__()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| 4e5af940_4e0a_f903_f8b7_85751445eef8
  d395c940_9db7_b72d_9170_063c5d4b05f7["get_name()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| d395c940_9db7_b72d_9170_063c5d4b05f7
  d1032926_dc3b_9f0a_89de_0bcd91e5d93c["InputType()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| d1032926_dc3b_9f0a_89de_0bcd91e5d93c
  618ae7a4_3e83_4d1f_df80_f6f98db34cd2["OutputType()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| 618ae7a4_3e83_4d1f_df80_f6f98db34cd2
  13d20d52_4c79_d0af_2a92_860f6ff70dda["get_input_schema()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| 13d20d52_4c79_d0af_2a92_860f6ff70dda
  5c03463d_d9a4_6bc4_f68e_f5ea083af59b["get_output_schema()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| 5c03463d_d9a4_6bc4_f68e_f5ea083af59b
  c04c830f_adbb_c55c_43d3_d6e7d226c503["config_specs()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| c04c830f_adbb_c55c_43d3_d6e7d226c503
  6625da3c_8f8e_7273_4e4d_8d4a09842871["get_graph()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| 6625da3c_8f8e_7273_4e4d_8d4a09842871
  4a5b3fa0_c7d5_a83b_4706_11b5e1326133["is_lc_serializable()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| 4a5b3fa0_c7d5_a83b_4706_11b5e1326133
  cd1a898b_3c11_1590_e200_793dba0b1412["get_lc_namespace()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| cd1a898b_3c11_1590_e200_793dba0b1412
  81b59d54_b77a_aa36_396c_ba7cdc717832["_merge_configs()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| 81b59d54_b77a_aa36_396c_ba7cdc717832
  4e780d65_b2dc_57f5_fd34_67cd74cf1153["invoke()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| 4e780d65_b2dc_57f5_fd34_67cd74cf1153
  eac0b0ee_0eb4_8d7b_e64e_049dda2abb56["ainvoke()"]
  fdec1b0d_a114_c2f1_9959_4128de6c9809 -->|method| eac0b0ee_0eb4_8d7b_e64e_049dda2abb56

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 5530–5929

class RunnableBindingBase(RunnableSerializable[Input, Output]):  # type: ignore[no-redef]
    """`Runnable` that delegates calls to another `Runnable` with a set of `**kwargs`.

    Use only if creating a new `RunnableBinding` subclass with different `__init__`
    args.

    See documentation for `RunnableBinding` for more details.

    """

    bound: Runnable[Input, Output]
    """The underlying `Runnable` that this `Runnable` delegates to."""

    kwargs: Mapping[str, Any] = Field(default_factory=dict)
    """kwargs to pass to the underlying `Runnable` when running.

    For example, when the `Runnable` binding is invoked the underlying
    `Runnable` will be invoked with the same input but with these additional
    kwargs.

    """

    config: RunnableConfig = Field(default_factory=RunnableConfig)
    """The config to bind to the underlying `Runnable`."""

    config_factories: list[Callable[[RunnableConfig], RunnableConfig]] = Field(
        default_factory=list
    )
    """The config factories to bind to the underlying `Runnable`."""

    # Union[Type[Input], BaseModel] + things like list[str]
    custom_input_type: Any | None = None
    """Override the input type of the underlying `Runnable` with a custom type.

    The type can be a Pydantic model, or a type annotation (e.g., `list[str]`).
    """
    # Union[Type[Output], BaseModel] + things like list[str]
    custom_output_type: Any | None = None
    """Override the output type of the underlying `Runnable` with a custom type.

    The type can be a Pydantic model, or a type annotation (e.g., `list[str]`).
    """

    model_config = ConfigDict(
        arbitrary_types_allowed=True,
    )

    def __init__(
        self,
        *,
        bound: Runnable[Input, Output],
        kwargs: Mapping[str, Any] | None = None,
        config: RunnableConfig | None = None,
        config_factories: list[Callable[[RunnableConfig], RunnableConfig]]
        | None = None,
        custom_input_type: type[Input] | BaseModel | None = None,
        custom_output_type: type[Output] | BaseModel | None = None,
        **other_kwargs: Any,
    ) -> None:
        """Create a `RunnableBinding` from a `Runnable` and kwargs.

        Args:
            bound: The underlying `Runnable` that this `Runnable` delegates calls
                to.
            kwargs: optional kwargs to pass to the underlying `Runnable`, when running
                the underlying `Runnable` (e.g., via `invoke`, `batch`,
                `transform`, or `stream` or async variants)

            config: optional config to bind to the underlying `Runnable`.

            config_factories: optional list of config factories to apply to the
                config before binding to the underlying `Runnable`.

            custom_input_type: Specify to override the input type of the underlying
                `Runnable` with a custom type.
            custom_output_type: Specify to override the output type of the underlying
                `Runnable` with a custom type.
            **other_kwargs: Unpacked into the base class.
        """
        super().__init__(
            bound=bound,

Frequently Asked Questions

What is the RunnableBindingBase class?
RunnableBindingBase is a class in the langchain codebase, defined in libs/core/langchain_core/runnables/base.py.
Where is RunnableBindingBase defined?
RunnableBindingBase is defined in libs/core/langchain_core/runnables/base.py at line 5530.

Analyze Your Own Codebase

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

Try Supermodel Free