Home / Class/ FakeChain Class — langchain Architecture

FakeChain Class — langchain Architecture

Architecture documentation for the FakeChain class in test_sequential.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  44b18a62_9f79_40e0_f9b2_f3eb9bd8536e["FakeChain"]
  f3cef70e_11b0_61c9_7ec0_7308f4b45056["Chain"]
  44b18a62_9f79_40e0_f9b2_f3eb9bd8536e -->|extends| f3cef70e_11b0_61c9_7ec0_7308f4b45056
  0021bb47_51ab_bafd_26b4_c2849000554a["test_sequential.py"]
  44b18a62_9f79_40e0_f9b2_f3eb9bd8536e -->|defined in| 0021bb47_51ab_bafd_26b4_c2849000554a
  3b145bb8_096d_5524_06e2_52f7e6f56088["input_keys()"]
  44b18a62_9f79_40e0_f9b2_f3eb9bd8536e -->|method| 3b145bb8_096d_5524_06e2_52f7e6f56088
  0c1bdb9b_662b_d6a6_facd_ef2fb40b13a7["output_keys()"]
  44b18a62_9f79_40e0_f9b2_f3eb9bd8536e -->|method| 0c1bdb9b_662b_d6a6_facd_ef2fb40b13a7
  c67d5411_5f94_302a_30e0_f2d760476ea7["_call()"]
  44b18a62_9f79_40e0_f9b2_f3eb9bd8536e -->|method| c67d5411_5f94_302a_30e0_f2d760476ea7
  5b06ae55_ed24_b1b5_bef9_bb76d7fc4cdb["_acall()"]
  44b18a62_9f79_40e0_f9b2_f3eb9bd8536e -->|method| 5b06ae55_ed24_b1b5_bef9_bb76d7fc4cdb

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/chains/test_sequential.py lines 19–57

class FakeChain(Chain):
    """Fake Chain for testing purposes."""

    input_variables: list[str]
    output_variables: list[str]

    @property
    def input_keys(self) -> list[str]:
        """Input keys this chain returns."""
        return self.input_variables

    @property
    def output_keys(self) -> list[str]:
        """Input keys this chain returns."""
        return self.output_variables

    @override
    def _call(
        self,
        inputs: dict[str, str],
        run_manager: CallbackManagerForChainRun | None = None,
    ) -> dict[str, str]:
        outputs = {}
        for var in self.output_variables:
            variables = [inputs[k] for k in self.input_variables]
            outputs[var] = f"{' '.join(variables)}foo"
        return outputs

    @override
    async def _acall(
        self,
        inputs: dict[str, str],
        run_manager: AsyncCallbackManagerForChainRun | None = None,
    ) -> dict[str, str]:
        outputs = {}
        for var in self.output_variables:
            variables = [inputs[k] for k in self.input_variables]
            outputs[var] = f"{' '.join(variables)}foo"
        return outputs

Extends

Frequently Asked Questions

What is the FakeChain class?
FakeChain is a class in the langchain codebase, defined in libs/langchain/tests/unit_tests/chains/test_sequential.py.
Where is FakeChain defined?
FakeChain is defined in libs/langchain/tests/unit_tests/chains/test_sequential.py at line 19.
What does FakeChain extend?
FakeChain extends Chain.

Analyze Your Own Codebase

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

Try Supermodel Free