AttributeError: 'Chat' object has no attribute 'features'

AttributeError: 'Chat' object has no attribute 'features'

在进行本小节测试的时候,发生如下报错:AttributeError: 'Chat' object has no attribute 'features'

https://img1.sycdn.imooc.com/climg/ecf81568096a31c821411125.jpg

Traceback (most recent call last):
  File "D:\Envs\llmops\lib\site-packages\werkzeug\wsgi.py", line 256, in __next__
    return self._next()
  File "D:\Envs\llmops\lib\site-packages\werkzeug\wrappers\response.py", line 32, in _iter_encoded
    for item in iterable:
  File "D:\Envs\llmops\lib\site-packages\flask\helpers.py", line 125, in generator
    yield from gen
  File "E:\Code\llmops\api\pkg\response\response.py", line 93, in generate
    yield from response
  File "E:\Code\llmops\api\internal\service\app_service.py", line 203, in debug_chat
    agent_class = FunctionCallAgent if ModelFeature.TOOL_CALL in llm.features else ReACTAgent
AttributeError: 'Chat' object has no attribute 'features'

发现deepseek Chat在进行实例化后features属性到model_kwargs中去了:

https://img1.sycdn.imooc.com/climg/8c066768096a324115461039.jpg

而能够成功运行的moonshot的features属性是正常的,并没有到model_kwargs中去:

https://img1.sycdn.imooc.com/climg/f07f9068096a328314380983.jpg

如下是两个模型的Chat定义:

https://img1.sycdn.imooc.com/climg/bc27b768096a329b14790587.jpg

请老师帮忙看看是哪里的问题吧

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
提问者 曲别针010 2025-07-06 19:46:42

刚才测试,又提示没有convert_to_human_message


https://img1.sycdn.imooc.com/climg/ac225b68096a611416790903.jpg

  • 提问者 曲别针010 #1

    找到原因了,是BaseLanguageModel导入错误了,正确的是导入自定义的BaseLanguageModel,之前导入的是langchain_core中的,已解决

    https://img1.sycdn.imooc.com/climg/44116c68096a648613440745.jpg

    2025-07-06 19:57:49
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
AI Agent 全栈开发工程师
  • 参与学习       500    人
  • 解答问题       404    个

全流程打造你自己的(Coze/Dify)低代码智能体开发平台;2025年入行正当时,企业急需,人才稀缺,竞争小;无论入行还是转行,首选口碑好课,门槛低、成长高

了解课程
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师