_construct_initial_inputs() — langchain Function Reference
Architecture documentation for the _construct_initial_inputs() function in refine.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 37a82994_6ed9_4853_ba28_ec381055abd1["_construct_initial_inputs()"] d0a9b180_8f2a_0a58_5392_0a04880a6b38["RefineDocumentsChain"] 37a82994_6ed9_4853_ba28_ec381055abd1 -->|defined in| d0a9b180_8f2a_0a58_5392_0a04880a6b38 65338410_0245_c6de_1cd9_f26020d9e985["combine_docs()"] 65338410_0245_c6de_1cd9_f26020d9e985 -->|calls| 37a82994_6ed9_4853_ba28_ec381055abd1 b8ccc423_c361_3ff8_e8ee_a7fc228a1cb1["acombine_docs()"] b8ccc423_c361_3ff8_e8ee_a7fc228a1cb1 -->|calls| 37a82994_6ed9_4853_ba28_ec381055abd1 style 37a82994_6ed9_4853_ba28_ec381055abd1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/combine_documents/refine.py lines 214–225
def _construct_initial_inputs(
self,
docs: list[Document],
**kwargs: Any,
) -> dict[str, Any]:
base_info = {"page_content": docs[0].page_content}
base_info.update(docs[0].metadata)
document_info = {k: base_info[k] for k in self.document_prompt.input_variables}
base_inputs: dict = {
self.document_variable_name: self.document_prompt.format(**document_info),
}
return {**base_inputs, **kwargs}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _construct_initial_inputs() do?
_construct_initial_inputs() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/combine_documents/refine.py.
Where is _construct_initial_inputs() defined?
_construct_initial_inputs() is defined in libs/langchain/langchain_classic/chains/combine_documents/refine.py at line 214.
What calls _construct_initial_inputs()?
_construct_initial_inputs() is called by 2 function(s): acombine_docs, combine_docs.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free