sequential.py — langchain Source File
Architecture documentation for sequential.py, a python file in the langchain codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ad5b5c43_91a3_7293_1f45_d2577f9abe35["sequential.py"] feec1ec4_6917_867b_d228_b134d0ff8099["typing"] ad5b5c43_91a3_7293_1f45_d2577f9abe35 --> feec1ec4_6917_867b_d228_b134d0ff8099 17a62cb3_fefd_6320_b757_b53bb4a1c661["langchain_core.callbacks"] ad5b5c43_91a3_7293_1f45_d2577f9abe35 --> 17a62cb3_fefd_6320_b757_b53bb4a1c661 642ed52d_bfb8_4975_afd4_eabf3187405c["langchain_core.utils.input"] ad5b5c43_91a3_7293_1f45_d2577f9abe35 --> 642ed52d_bfb8_4975_afd4_eabf3187405c dd5e7909_a646_84f1_497b_cae69735550e["pydantic"] ad5b5c43_91a3_7293_1f45_d2577f9abe35 --> dd5e7909_a646_84f1_497b_cae69735550e f85fae70_1011_eaec_151c_4083140ae9e5["typing_extensions"] ad5b5c43_91a3_7293_1f45_d2577f9abe35 --> f85fae70_1011_eaec_151c_4083140ae9e5 9a0fc770_8c3f_14bc_3c7d_37852927778e["langchain_classic.chains.base"] ad5b5c43_91a3_7293_1f45_d2577f9abe35 --> 9a0fc770_8c3f_14bc_3c7d_37852927778e style ad5b5c43_91a3_7293_1f45_d2577f9abe35 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Chain pipeline where the outputs of one step feed directly into next."""
from typing import Any
from langchain_core.callbacks import (
AsyncCallbackManagerForChainRun,
CallbackManagerForChainRun,
)
from langchain_core.utils.input import get_color_mapping
from pydantic import ConfigDict, model_validator
from typing_extensions import Self
from langchain_classic.chains.base import Chain
class SequentialChain(Chain):
"""Chain where the outputs of one chain feed directly into next."""
chains: list[Chain]
input_variables: list[str]
output_variables: list[str]
return_all: bool = False
model_config = ConfigDict(
arbitrary_types_allowed=True,
extra="forbid",
)
@property
def input_keys(self) -> list[str]:
"""Return expected input keys to the chain."""
return self.input_variables
@property
def output_keys(self) -> list[str]:
"""Return output key."""
return self.output_variables
@model_validator(mode="before")
@classmethod
def validate_chains(cls, values: dict) -> Any:
"""Validate that the correct inputs exist for all chains."""
chains = values["chains"]
input_variables = values["input_variables"]
memory_keys = []
if "memory" in values and values["memory"] is not None:
"""Validate that prompt input variables are consistent."""
memory_keys = values["memory"].memory_variables
if set(input_variables).intersection(set(memory_keys)):
overlapping_keys = set(input_variables) & set(memory_keys)
msg = (
f"The input key(s) {''.join(overlapping_keys)} are found "
f"in the Memory keys ({memory_keys}) - please use input and "
f"memory keys that don't overlap."
)
raise ValueError(msg)
known_variables = set(input_variables + memory_keys)
for chain in chains:
// ... (149 more lines)
Domain
Subdomains
Dependencies
- langchain_classic.chains.base
- langchain_core.callbacks
- langchain_core.utils.input
- pydantic
- typing
- typing_extensions
Source
Frequently Asked Questions
What does sequential.py do?
sequential.py is a source file in the langchain codebase, written in python. It belongs to the AgentOrchestration domain, ClassicChains subdomain.
What does sequential.py depend on?
sequential.py imports 6 module(s): langchain_classic.chains.base, langchain_core.callbacks, langchain_core.utils.input, pydantic, typing, typing_extensions.
Where is sequential.py in the architecture?
sequential.py is located at libs/langchain/langchain_classic/chains/sequential.py (domain: AgentOrchestration, subdomain: ClassicChains, directory: libs/langchain/langchain_classic/chains).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free