Home / Function/ validate_chains() — langchain Function Reference

validate_chains() — langchain Function Reference

Architecture documentation for the validate_chains() function in sequential.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  dbb29170_cc29_b773_e4de_50231f248825["validate_chains()"]
  d01877d8_1123_f550_8a2f_0981eecde24e["SimpleSequentialChain"]
  dbb29170_cc29_b773_e4de_50231f248825 -->|defined in| d01877d8_1123_f550_8a2f_0981eecde24e
  9a79e356_f008_9ba8_a047_1413b54e13c6["validate_chains()"]
  9a79e356_f008_9ba8_a047_1413b54e13c6 -->|calls| dbb29170_cc29_b773_e4de_50231f248825
  9a79e356_f008_9ba8_a047_1413b54e13c6["validate_chains()"]
  dbb29170_cc29_b773_e4de_50231f248825 -->|calls| 9a79e356_f008_9ba8_a047_1413b54e13c6
  style dbb29170_cc29_b773_e4de_50231f248825 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/sequential.py lines 147–162

    def validate_chains(self) -> Self:
        """Validate that chains are all single input/output."""
        for chain in self.chains:
            if len(chain.input_keys) != 1:
                msg = (
                    "Chains used in SimplePipeline should all have one input, got "
                    f"{chain} with {len(chain.input_keys)} inputs."
                )
                raise ValueError(msg)
            if len(chain.output_keys) != 1:
                msg = (
                    "Chains used in SimplePipeline should all have one output, got "
                    f"{chain} with {len(chain.output_keys)} outputs."
                )
                raise ValueError(msg)
        return self

Subdomains

Called By

Frequently Asked Questions

What does validate_chains() do?
validate_chains() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/sequential.py.
Where is validate_chains() defined?
validate_chains() is defined in libs/langchain/langchain_classic/chains/sequential.py at line 147.
What does validate_chains() call?
validate_chains() calls 1 function(s): validate_chains.
What calls validate_chains()?
validate_chains() is called by 1 function(s): validate_chains.

Analyze Your Own Codebase

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

Try Supermodel Free