get_default_document_variable_name() — langchain Function Reference
Architecture documentation for the get_default_document_variable_name() function in refine.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 0e47fcc0_ce15_4829_b595_ad6347624db4["get_default_document_variable_name()"] d0a9b180_8f2a_0a58_5392_0a04880a6b38["RefineDocumentsChain"] 0e47fcc0_ce15_4829_b595_ad6347624db4 -->|defined in| d0a9b180_8f2a_0a58_5392_0a04880a6b38 style 0e47fcc0_ce15_4829_b595_ad6347624db4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/combine_documents/refine.py lines 121–143
def get_default_document_variable_name(cls, values: dict) -> Any:
"""Get default document variable name, if not provided."""
if "initial_llm_chain" not in values:
msg = "initial_llm_chain must be provided"
raise ValueError(msg)
llm_chain_variables = values["initial_llm_chain"].prompt.input_variables
if "document_variable_name" not in values:
if len(llm_chain_variables) == 1:
values["document_variable_name"] = llm_chain_variables[0]
else:
msg = (
"document_variable_name must be provided if there are "
"multiple llm_chain input_variables"
)
raise ValueError(msg)
elif values["document_variable_name"] not in llm_chain_variables:
msg = (
f"document_variable_name {values['document_variable_name']} was "
f"not found in llm_chain input_variables: {llm_chain_variables}"
)
raise ValueError(msg)
return values
Domain
Subdomains
Source
Frequently Asked Questions
What does get_default_document_variable_name() do?
get_default_document_variable_name() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/combine_documents/refine.py.
Where is get_default_document_variable_name() defined?
get_default_document_variable_name() is defined in libs/langchain/langchain_classic/chains/combine_documents/refine.py at line 121.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free