Home / Function/ _call() — langchain Function Reference

_call() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  d4377005_d592_4f81_ac05_8d26750ca867["_call()"]
  5201e8ad_1740_ce23_1ab6_cafdbc91f78c["MapReduceChain"]
  d4377005_d592_4f81_ac05_8d26750ca867 -->|defined in| 5201e8ad_1740_ce23_1ab6_cafdbc91f78c
  style d4377005_d592_4f81_ac05_8d26750ca867 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/mapreduce.py lines 98–116

    def _call(
        self,
        inputs: dict[str, str],
        run_manager: CallbackManagerForChainRun | None = None,
    ) -> dict[str, str]:
        _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager()
        # Split the larger text into smaller chunks.
        doc_text = inputs.pop(self.input_key)
        texts = self.text_splitter.split_text(doc_text)
        docs = [Document(page_content=text) for text in texts]
        _inputs: dict[str, Any] = {
            **inputs,
            self.combine_documents_chain.input_key: docs,
        }
        outputs = self.combine_documents_chain.run(
            _inputs,
            callbacks=_run_manager.get_child(),
        )
        return {self.output_key: outputs}

Subdomains

Frequently Asked Questions

What does _call() do?
_call() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/mapreduce.py.
Where is _call() defined?
_call() is defined in libs/langchain/langchain_classic/chains/mapreduce.py at line 98.

Analyze Your Own Codebase

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

Try Supermodel Free