Home / Function/ combine_docs() — langchain Function Reference

combine_docs() — langchain Function Reference

Architecture documentation for the combine_docs() function in stuff.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  dae29ee3_4a9d_1ba1_f5e1_6b7cfa261600["combine_docs()"]
  2d0480d1_fbf6_c0df_d443_92c8437d1fff["StuffDocumentsChain"]
  dae29ee3_4a9d_1ba1_f5e1_6b7cfa261600 -->|defined in| 2d0480d1_fbf6_c0df_d443_92c8437d1fff
  e7742348_cc60_c503_d46b_e83cb5c9de9a["_get_inputs()"]
  dae29ee3_4a9d_1ba1_f5e1_6b7cfa261600 -->|calls| e7742348_cc60_c503_d46b_e83cb5c9de9a
  style dae29ee3_4a9d_1ba1_f5e1_6b7cfa261600 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/combine_documents/stuff.py lines 247–266

    def combine_docs(
        self,
        docs: list[Document],
        callbacks: Callbacks = None,
        **kwargs: Any,
    ) -> tuple[str, dict]:
        """Stuff all documents into one prompt and pass to LLM.

        Args:
            docs: List of documents to join together into one variable
            callbacks: Optional callbacks to pass along
            **kwargs: additional parameters to use to get inputs to LLMChain.

        Returns:
            The first element returned is the single string output. The second
            element returned is a dictionary of other keys to return.
        """
        inputs = self._get_inputs(docs, **kwargs)
        # Call predict on the LLM.
        return self.llm_chain.predict(callbacks=callbacks, **inputs), {}

Subdomains

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/stuff.py.
Where is combine_docs() defined?
combine_docs() is defined in libs/langchain/langchain_classic/chains/combine_documents/stuff.py at line 247.
What does combine_docs() call?
combine_docs() calls 1 function(s): _get_inputs.

Analyze Your Own Codebase

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

Try Supermodel Free