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
  1ea4a52c_0867_4fcb_dd5a_6056c78eabd9["_call()"]
  b9a82d83_700a_c3c4_a4fd_29ab9cbe4112["APIChain"]
  1ea4a52c_0867_4fcb_dd5a_6056c78eabd9 -->|defined in| b9a82d83_700a_c3c4_a4fd_29ab9cbe4112
  0393cea2_16ff_2ed6_ebe5_2e7f4968843e["langchain_community()"]
  0393cea2_16ff_2ed6_ebe5_2e7f4968843e -->|calls| 1ea4a52c_0867_4fcb_dd5a_6056c78eabd9
  357f19d8_3422_6a9d_533d_c62f93023ce8["_check_in_allowed_domain()"]
  1ea4a52c_0867_4fcb_dd5a_6056c78eabd9 -->|calls| 357f19d8_3422_6a9d_533d_c62f93023ce8
  style 1ea4a52c_0867_4fcb_dd5a_6056c78eabd9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/api/base.py lines 277–313

        def _call(
            self,
            inputs: dict[str, Any],
            run_manager: CallbackManagerForChainRun | None = None,
        ) -> dict[str, str]:
            _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager()
            question = inputs[self.question_key]
            api_url = self.api_request_chain.predict(
                question=question,
                api_docs=self.api_docs,
                callbacks=_run_manager.get_child(),
            )
            _run_manager.on_text(api_url, color="green", end="\n", verbose=self.verbose)
            api_url = api_url.strip()
            if self.limit_to_domains and not _check_in_allowed_domain(
                api_url,
                self.limit_to_domains,
            ):
                msg = (
                    f"{api_url} is not in the allowed domains: {self.limit_to_domains}"
                )
                raise ValueError(msg)
            api_response = self.requests_wrapper.get(api_url)
            _run_manager.on_text(
                str(api_response),
                color="yellow",
                end="\n",
                verbose=self.verbose,
            )
            answer = self.api_answer_chain.predict(
                question=question,
                api_docs=self.api_docs,
                api_url=api_url,
                api_response=api_response,
                callbacks=_run_manager.get_child(),
            )
            return {self.output_key: answer}

Subdomains

Frequently Asked Questions

What does _call() do?
_call() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/api/base.py.
Where is _call() defined?
_call() is defined in libs/langchain/langchain_classic/chains/api/base.py at line 277.
What does _call() call?
_call() calls 1 function(s): _check_in_allowed_domain.
What calls _call()?
_call() is called by 1 function(s): langchain_community.

Analyze Your Own Codebase

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

Try Supermodel Free