Home / Function/ _call() — langchain Function Reference

_call() — langchain Function Reference

Architecture documentation for the _call() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  895503b7_0854_2cce_f272_84c2606acbb1["_call()"]
  741a7f73_f662_9d17_6b91_e7e8709f4338["MultiRouteChain"]
  895503b7_0854_2cce_f272_84c2606acbb1 -->|defined in| 741a7f73_f662_9d17_6b91_e7e8709f4338
  5d25b120_ec51_3b5f_5c80_bc6802d11e97["route()"]
  895503b7_0854_2cce_f272_84c2606acbb1 -->|calls| 5d25b120_ec51_3b5f_5c80_bc6802d11e97
  style 895503b7_0854_2cce_f272_84c2606acbb1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/router/base.py lines 93–116

    def _call(
        self,
        inputs: dict[str, Any],
        run_manager: CallbackManagerForChainRun | None = None,
    ) -> dict[str, Any]:
        _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager()
        callbacks = _run_manager.get_child()
        route = self.router_chain.route(inputs, callbacks=callbacks)

        _run_manager.on_text(
            str(route.destination) + ": " + str(route.next_inputs),
            verbose=self.verbose,
        )
        if not route.destination:
            return self.default_chain(route.next_inputs, callbacks=callbacks)
        if route.destination in self.destination_chains:
            return self.destination_chains[route.destination](
                route.next_inputs,
                callbacks=callbacks,
            )
        if self.silent_errors:
            return self.default_chain(route.next_inputs, callbacks=callbacks)
        msg = f"Received invalid destination chain name '{route.destination}'"
        raise ValueError(msg)

Subdomains

Calls

Frequently Asked Questions

What does _call() do?
_call() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/router/base.py.
Where is _call() defined?
_call() is defined in libs/langchain/langchain_classic/chains/router/base.py at line 93.
What does _call() call?
_call() calls 1 function(s): route.

Analyze Your Own Codebase

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

Try Supermodel Free