_get_inputs() — langchain Function Reference
Architecture documentation for the _get_inputs() function in stuff.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e7742348_cc60_c503_d46b_e83cb5c9de9a["_get_inputs()"] 2d0480d1_fbf6_c0df_d443_92c8437d1fff["StuffDocumentsChain"] e7742348_cc60_c503_d46b_e83cb5c9de9a -->|defined in| 2d0480d1_fbf6_c0df_d443_92c8437d1fff 59bc2403_9bf0_8dbd_e707_e0536608da83["prompt_length()"] 59bc2403_9bf0_8dbd_e707_e0536608da83 -->|calls| e7742348_cc60_c503_d46b_e83cb5c9de9a dae29ee3_4a9d_1ba1_f5e1_6b7cfa261600["combine_docs()"] dae29ee3_4a9d_1ba1_f5e1_6b7cfa261600 -->|calls| e7742348_cc60_c503_d46b_e83cb5c9de9a ee1c7e93_6132_f120_3775_2b63f3575677["acombine_docs()"] ee1c7e93_6132_f120_3775_2b63f3575677 -->|calls| e7742348_cc60_c503_d46b_e83cb5c9de9a style e7742348_cc60_c503_d46b_e83cb5c9de9a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/combine_documents/stuff.py lines 201–225
def _get_inputs(self, docs: list[Document], **kwargs: Any) -> dict:
"""Construct inputs from kwargs and docs.
Format and then join all the documents together into one input with name
`self.document_variable_name`. Also pluck any additional variables
from **kwargs.
Args:
docs: List of documents to format and then join into single input
**kwargs: additional inputs to chain, will pluck any other required
arguments from here.
Returns:
dictionary of inputs to LLMChain
"""
# Format each document according to the prompt
doc_strings = [format_document(doc, self.document_prompt) for doc in docs]
# Join the documents together to put them in the prompt.
inputs = {
k: v
for k, v in kwargs.items()
if k in self.llm_chain.prompt.input_variables
}
inputs[self.document_variable_name] = self.document_separator.join(doc_strings)
return inputs
Domain
Subdomains
Source
Frequently Asked Questions
What does _get_inputs() do?
_get_inputs() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/combine_documents/stuff.py.
Where is _get_inputs() defined?
_get_inputs() is defined in libs/langchain/langchain_classic/chains/combine_documents/stuff.py at line 201.
What calls _get_inputs()?
_get_inputs() is called by 3 function(s): acombine_docs, combine_docs, prompt_length.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free