AttributeError: 'RunnableSequence'无'prompt'属性问题原因解析
错误原因解析
- 类型不匹配是根本问题:
- 用
reduce_prompt | llm_model生成的reduce_chain是RunnableSequence对象(LangChain表达式链的产物),这个对象没有prompt属性。 StuffDocumentsChain的llm_chain参数必须接收LLMChain类的实例,LLMChain内部自带prompt属性,能被StuffDocumentsChain正常调用。
- 用
- 改用
LLMChain(prompt = reduce_prompt, llm=llm_model)后,生成的是标准LLMChain实例,完全满足StuffDocumentsChain的参数要求,所以代码能正常运行。
内容的提问来源于stack exchange,提问作者PingPong
相关产品推荐
相关产品推荐

