The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Optimize code (#3412)
张城铭487a57ffe6ba
diff --git a/langchain/chains/combine_documents/stuff.py b/langchain/chains/combine_documents/stuff.pyindex 237ecc2d4f..9d0a141c1b 100644--- a/langchain/chains/combine_documents/stuff.py+++ b/langchain/chains/combine_documents/stuff.py@@ -40,8 +40,8 @@ class StuffDocumentsChain(BaseCombineDocumentsChain):@root_validator(pre=True)def get_default_document_variable_name(cls, values: Dict) -> Dict:"""Get default document variable name, if not provided."""+ llm_chain_variables = values["llm_chain"].prompt.input_variablesif "document_variable_name" not in values:- llm_chain_variables = values["llm_chain"].prompt.input_variablesif len(llm_chain_variables) == 1:values["document_variable_name"] = llm_chain_variables[0]else:@@ -50,7 +50,6 @@ class StuffDocumentsChain(BaseCombineDocumentsChain):"multiple llm_chain_variables")else:- llm_chain_variables = values["llm_chain"].prompt.input_variablesif values["document_variable_name"] not in llm_chain_variables:raise ValueError(f"document_variable_name {values['document_variable_name']} was "