combine_docs() — langchain Function Reference
Architecture documentation for the combine_docs() function in map_rerank.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 3ee542d4_6c5f_5591_2901_27a70f133c10["combine_docs()"] ee80b7d6_d087_8cc2_13e6_51659dee89b4["MapRerankDocumentsChain"] 3ee542d4_6c5f_5591_2901_27a70f133c10 -->|defined in| ee80b7d6_d087_8cc2_13e6_51659dee89b4 04e51b41_5072_aa90_26eb_d0a9395e5846["_process_results()"] 3ee542d4_6c5f_5591_2901_27a70f133c10 -->|calls| 04e51b41_5072_aa90_26eb_d0a9395e5846 style 3ee542d4_6c5f_5591_2901_27a70f133c10 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py lines 170–195
def combine_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 = self.llm_chain.apply_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)
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does combine_docs() do?
combine_docs() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py.
Where is combine_docs() defined?
combine_docs() is defined in libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py at line 170.
What does combine_docs() call?
combine_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