Home / Function/ with_config() — langchain Function Reference

with_config() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3a9e8465_a089_ea36_1618_e9ce948afd66["with_config()"]
  4022a4a7_2f12_918e_95f7_87d452c5dc9e["Runnable"]
  3a9e8465_a089_ea36_1618_e9ce948afd66 -->|defined in| 4022a4a7_2f12_918e_95f7_87d452c5dc9e
  6ed9020f_9c07_bc20_a2bb_22f1e9e47a32["with_config()"]
  6ed9020f_9c07_bc20_a2bb_22f1e9e47a32 -->|calls| 3a9e8465_a089_ea36_1618_e9ce948afd66
  dfbf4743_c4b6_baff_73dd_528f924664a0["with_config()"]
  dfbf4743_c4b6_baff_73dd_528f924664a0 -->|calls| 3a9e8465_a089_ea36_1618_e9ce948afd66
  a1fced68_fe4f_59d7_1419_2eefc8db7dfd["astream_events()"]
  a1fced68_fe4f_59d7_1419_2eefc8db7dfd -->|calls| 3a9e8465_a089_ea36_1618_e9ce948afd66
  790ea45e_3d1f_0375_a787_9ed49583e8e4["configurable_fields()"]
  790ea45e_3d1f_0375_a787_9ed49583e8e4 -->|calls| 3a9e8465_a089_ea36_1618_e9ce948afd66
  616e140c_fddf_2de6_006c_392d928a6001["configurable_alternatives()"]
  616e140c_fddf_2de6_006c_392d928a6001 -->|calls| 3a9e8465_a089_ea36_1618_e9ce948afd66
  dfbf4743_c4b6_baff_73dd_528f924664a0["with_config()"]
  3a9e8465_a089_ea36_1618_e9ce948afd66 -->|calls| dfbf4743_c4b6_baff_73dd_528f924664a0
  style 3a9e8465_a089_ea36_1618_e9ce948afd66 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 1644–1667

    def with_config(
        self,
        config: RunnableConfig | None = None,
        # Sadly Unpack is not well-supported by mypy so this will have to be untyped
        **kwargs: Any,
    ) -> Runnable[Input, Output]:
        """Bind config to a `Runnable`, returning a new `Runnable`.

        Args:
            config: The config to bind to the `Runnable`.
            **kwargs: Additional keyword arguments to pass to the `Runnable`.

        Returns:
            A new `Runnable` with the config bound.

        """
        return RunnableBinding(
            bound=self,
            config=cast(
                "RunnableConfig",
                {**(config or {}), **kwargs},
            ),
            kwargs={},
        )

Subdomains

Frequently Asked Questions

What does with_config() do?
with_config() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/base.py.
Where is with_config() defined?
with_config() is defined in libs/core/langchain_core/runnables/base.py at line 1644.
What does with_config() call?
with_config() calls 1 function(s): with_config.
What calls with_config()?
with_config() is called by 5 function(s): astream_events, configurable_alternatives, configurable_fields, with_config, with_config.

Analyze Your Own Codebase

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

Try Supermodel Free