Home / Function/ acombine_docs() — langchain Function Reference

acombine_docs() — langchain Function Reference

Architecture documentation for the acombine_docs() function in map_rerank.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  5744a8f1_eae7_a731_34d0_2d43bba6a9cc["acombine_docs()"]
  ee80b7d6_d087_8cc2_13e6_51659dee89b4["MapRerankDocumentsChain"]
  5744a8f1_eae7_a731_34d0_2d43bba6a9cc -->|defined in| ee80b7d6_d087_8cc2_13e6_51659dee89b4
  04e51b41_5072_aa90_26eb_d0a9395e5846["_process_results()"]
  5744a8f1_eae7_a731_34d0_2d43bba6a9cc -->|calls| 04e51b41_5072_aa90_26eb_d0a9395e5846
  style 5744a8f1_eae7_a731_34d0_2d43bba6a9cc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py lines 197–222

    async def acombine_docs(
        self,
        docs: list[Document],
        callbacks: Callbacks = None,
        **kwargs: Any,
    ) -> tuple[str, dict]:
        """Combine documents in a map rerank manner.

        Combine by mapping first chain over all documents, then reranking the results.

        Args:
            docs: List of documents to combine
            callbacks: Callbacks to be passed through
            **kwargs: additional parameters to be passed to LLM calls (like other
                input variables besides the documents)

        Returns:
            The first element returned is the single string output. The second
            element returned is a dictionary of other keys to return.
        """
        results = await self.llm_chain.aapply_and_parse(
            # FYI - this is parallelized and so it is fast.
            [{self.document_variable_name: d.page_content, **kwargs} for d in docs],
            callbacks=callbacks,
        )
        return self._process_results(docs, results)

Subdomains

Frequently Asked Questions

What does acombine_docs() do?
acombine_docs() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py.
Where is acombine_docs() defined?
acombine_docs() is defined in libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py at line 197.
What does acombine_docs() call?
acombine_docs() calls 1 function(s): _process_results.

Analyze Your Own Codebase

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

Try Supermodel Free