Home / Function/ assign() — langchain Function Reference

assign() — langchain Function Reference

Architecture documentation for the assign() function in passthrough.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  933ccc14_844d_c42a_d3ca_33f04cdfba48["assign()"]
  915f0e72_2130_6a8d_6929_3a7528446033["RunnablePassthrough"]
  933ccc14_844d_c42a_d3ca_33f04cdfba48 -->|defined in| 915f0e72_2130_6a8d_6929_3a7528446033
  62dea3ab_c5ad_9f07_f870_49252fed7180["_invoke()"]
  62dea3ab_c5ad_9f07_f870_49252fed7180 -->|calls| 933ccc14_844d_c42a_d3ca_33f04cdfba48
  6d319a01_0b1e_1be7_7e50_60d7aa44abbb["_ainvoke()"]
  6d319a01_0b1e_1be7_7e50_60d7aa44abbb -->|calls| 933ccc14_844d_c42a_d3ca_33f04cdfba48
  a51fc650_dd24_4986_7118_5682f1932c8b["_transform()"]
  a51fc650_dd24_4986_7118_5682f1932c8b -->|calls| 933ccc14_844d_c42a_d3ca_33f04cdfba48
  792ae3d8_8499_60c2_cf08_c723693f4e67["_atransform()"]
  792ae3d8_8499_60c2_cf08_c723693f4e67 -->|calls| 933ccc14_844d_c42a_d3ca_33f04cdfba48
  3a36dbf6_6c2b_7362_1ddb_d7fe56086df3["_pick()"]
  3a36dbf6_6c2b_7362_1ddb_d7fe56086df3 -->|calls| 933ccc14_844d_c42a_d3ca_33f04cdfba48
  style 933ccc14_844d_c42a_d3ca_33f04cdfba48 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/passthrough.py lines 207–223

    def assign(
        cls,
        **kwargs: Runnable[dict[str, Any], Any]
        | Callable[[dict[str, Any]], Any]
        | Mapping[str, Runnable[dict[str, Any], Any] | Callable[[dict[str, Any]], Any]],
    ) -> RunnableAssign:
        """Merge the Dict input with the output produced by the mapping argument.

        Args:
            **kwargs: `Runnable`, `Callable` or a `Mapping` from keys to `Runnable`
                objects or `Callable`s.

        Returns:
            A `Runnable` that merges the `dict` input with the output produced by the
            mapping argument.
        """
        return RunnableAssign(RunnableParallel[dict[str, Any]](kwargs))

Domain

Subdomains

Frequently Asked Questions

What does assign() do?
assign() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/passthrough.py.
Where is assign() defined?
assign() is defined in libs/core/langchain_core/runnables/passthrough.py at line 207.
What calls assign()?
assign() is called by 5 function(s): _ainvoke, _atransform, _invoke, _pick, _transform.

Analyze Your Own Codebase

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

Try Supermodel Free