combine_docs() — langchain Function Reference
Architecture documentation for the combine_docs() function in reduce.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD cc4540ae_400a_89bd_9f59_c90678c2a044["combine_docs()"] 1d761688_0112_f998_eecc_6712fc22bf37["ReduceDocumentsChain"] cc4540ae_400a_89bd_9f59_c90678c2a044 -->|defined in| 1d761688_0112_f998_eecc_6712fc22bf37 5ec5e85d_0e34_733e_07b9_d13ee52ef47f["_collapse()"] cc4540ae_400a_89bd_9f59_c90678c2a044 -->|calls| 5ec5e85d_0e34_733e_07b9_d13ee52ef47f style cc4540ae_400a_89bd_9f59_c90678c2a044 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/combine_documents/reduce.py lines 241–273
def combine_docs(
self,
docs: list[Document],
token_max: int | None = None,
callbacks: Callbacks = None,
**kwargs: Any,
) -> tuple[str, dict]:
"""Combine multiple documents recursively.
Args:
docs: List of documents to combine, assumed that each one is less than
`token_max`.
token_max: Recursively creates groups of documents less than this number
of tokens.
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.
"""
result_docs, _ = self._collapse(
docs,
token_max=token_max,
callbacks=callbacks,
**kwargs,
)
return self.combine_documents_chain.combine_docs(
docs=result_docs,
callbacks=callbacks,
**kwargs,
)
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/reduce.py.
Where is combine_docs() defined?
combine_docs() is defined in libs/langchain/langchain_classic/chains/combine_documents/reduce.py at line 241.
What does combine_docs() call?
combine_docs() calls 1 function(s): _collapse.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free