Home / File/ passthrough.py — langchain Source File

passthrough.py — langchain Source File

Architecture documentation for passthrough.py, a python file in the langchain codebase. 15 imports, 0 dependents.

File python CoreAbstractions Serialization 15 imports 3 functions 3 classes

Entity Profile

Dependency Diagram

graph LR
  74fd3998_c4d9_f441_95fd_4c9845487771["passthrough.py"]
  a327e534_84f6_5308_58ca_5727d5eda0cf["asyncio"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> a327e534_84f6_5308_58ca_5727d5eda0cf
  614e7b9f_ed51_0780_749c_ff40b74963fc["inspect"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> 614e7b9f_ed51_0780_749c_ff40b74963fc
  242d0b7d_a8ef_b66d_169b_c791b32a9cc9["threading"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> 242d0b7d_a8ef_b66d_169b_c791b32a9cc9
  cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  6e58aaea_f08e_c099_3cc7_f9567bfb1ae7["pydantic"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7
  91721f45_4909_e489_8c1f_084f8bd87145["typing_extensions"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> 91721f45_4909_e489_8c1f_084f8bd87145
  c764ccae_0d75_abec_7c23_6d5d1949a7ba["langchain_core.runnables.base"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> c764ccae_0d75_abec_7c23_6d5d1949a7ba
  2971f9da_6393_a3e3_610e_ace3d35ee978["langchain_core.runnables.config"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> 2971f9da_6393_a3e3_610e_ace3d35ee978
  81c04601_d095_a27d_4af1_55e771bb2b6b["langchain_core.runnables.utils"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> 81c04601_d095_a27d_4af1_55e771bb2b6b
  093e7fce_331f_eaa8_76e6_694099ef19a1["langchain_core.utils.aiter"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> 093e7fce_331f_eaa8_76e6_694099ef19a1
  fb97a5dd_8baa_cbb1_1219_066aff1f076c["langchain_core.utils.iter"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> fb97a5dd_8baa_cbb1_1219_066aff1f076c
  1014fe78_cb2c_fde4_a624_ae899aa7ca8e["langchain_core.utils.pydantic"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> 1014fe78_cb2c_fde4_a624_ae899aa7ca8e
  e8ec017e_6c91_4b34_675f_2a96c5aa9be6["langchain_core.callbacks.manager"]
  74fd3998_c4d9_f441_95fd_4c9845487771 --> e8ec017e_6c91_4b34_675f_2a96c5aa9be6
  style 74fd3998_c4d9_f441_95fd_4c9845487771 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Implementation of the `RunnablePassthrough`."""

from __future__ import annotations

import asyncio
import inspect
import threading
from collections.abc import Awaitable, Callable
from typing import (
    TYPE_CHECKING,
    Any,
    cast,
)

from pydantic import BaseModel, RootModel
from typing_extensions import override

from langchain_core.runnables.base import (
    Other,
    Runnable,
    RunnableParallel,
    RunnableSerializable,
)
from langchain_core.runnables.config import (
    RunnableConfig,
    acall_func_with_variable_args,
    call_func_with_variable_args,
    ensure_config,
    get_executor_for_config,
    patch_config,
)
from langchain_core.runnables.utils import (
    AddableDict,
    ConfigurableFieldSpec,
)
from langchain_core.utils.aiter import atee
from langchain_core.utils.iter import safetee
from langchain_core.utils.pydantic import create_model_v2

if TYPE_CHECKING:
    from collections.abc import AsyncIterator, Iterator, Mapping

    from langchain_core.callbacks.manager import (
        AsyncCallbackManagerForChainRun,
        CallbackManagerForChainRun,
    )
    from langchain_core.runnables.graph import Graph


def identity(x: Other) -> Other:
    """Identity function.

    Args:
        x: Input.

    Returns:
        Output.
    """
    return x

// ... (782 more lines)

Subdomains

Dependencies

  • asyncio
  • collections.abc
  • inspect
  • langchain_core.callbacks.manager
  • langchain_core.runnables.base
  • langchain_core.runnables.config
  • langchain_core.runnables.graph
  • langchain_core.runnables.utils
  • langchain_core.utils.aiter
  • langchain_core.utils.iter
  • langchain_core.utils.pydantic
  • pydantic
  • threading
  • typing
  • typing_extensions

Frequently Asked Questions

What does passthrough.py do?
passthrough.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in passthrough.py?
passthrough.py defines 3 function(s): aidentity, collections, identity.
What does passthrough.py depend on?
passthrough.py imports 15 module(s): asyncio, collections.abc, inspect, langchain_core.callbacks.manager, langchain_core.runnables.base, langchain_core.runnables.config, langchain_core.runnables.graph, langchain_core.runnables.utils, and 7 more.
Where is passthrough.py in the architecture?
passthrough.py is located at libs/core/langchain_core/runnables/passthrough.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/core/langchain_core/runnables).

Analyze Your Own Codebase

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

Try Supermodel Free