-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
What happened / 发生了什么
deepseekAPI在12月1号的更新中开放了reasoner模型的工具调用功能,astrbot还没对思考模式下的工具调用进行适配
DeepSeek API要求在使用思考模式进行工具调用时,助手消息必须包含 reasoning_content 字段
这个字段用于存储模型的思考过程和推理内容
可能是AstrBot的消息格式没有完全符合DeepSeek API的最新要求
Reproduce / 如何复现?
在webchat中打开联网搜索,启用reasoner模型,提问:联网搜索BING
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
4.10.1 Windows launcher deepseek webchat
OS
Windows
Logs / 报错日志
AstrBot 请求失败。
错误类型: BadRequestError
错误信息: Error code: 400 - {‘error’: {‘message’: 'Missing reasoning_content field in the assistant message at message index 6. For more information, please refer to https://api-docs.deepseek.com/guides/thinking_mode#tool-calls', ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: ‘invalid_request_error’}}
[12:16:23] [Core] [INFO] [core.event_bus:59]: [default] [webchat(webchat)] test/test: 联网搜索BING
[12:16:26] [Core] [INFO] [respond.stage:168]: Prepare to send - test/test:
[12:16:26] [Core] [INFO] [respond.stage:184]: 应用流式输出(webchat)
[12:16:40] [Core] [INFO] [runners.tool_loop_agent_runner:266]: Agent 使用工具: ['web_search']
[12:16:40] [Core] [INFO] [runners.tool_loop_agent_runner:291]: 使用工具:web_search,参数:{'query': 'C语言课堂观摩 教学实践 教学管理', 'max_results': 5}
[12:16:40] [Core] [INFO] [web_searcher.main:209]: web_searcher - search_from_search_engine: C语言课堂观摩 教学实践 教学管理
[12:16:41] [Core] [INFO] [web_searcher.main:74]: web_searcher - scraping web: C 语言和 C++、C# 的区别在什么地方? - 知乎 - https://www.zhihu.com › question
[12:16:41] [Core] [INFO] [web_searcher.main:74]: web_searcher - scraping web: c盘满了怎么办怎么清理? - 知乎 - https://www.zhihu.com › question
[12:16:41] [Core] [INFO] [web_searcher.main:74]: web_searcher - scraping web: 摄氏度符号 ℃怎么写?_百度知道 - https://zhidao.baidu.com › question
[12:16:41] [Core] [INFO] [web_searcher.main:74]: web_searcher - scraping web: C盘APPData目录如何清理,目前占用了几十G? - 知乎 - https://www.zhihu.com › question
[12:16:41] [Core] [INFO] [web_searcher.main:74]: web_searcher - scraping web: 湖南的湘A、湘B、湘C、湘D、湘E、湘F、湘G分别代表哪 ... - https://zhidao.baidu.com › question
[12:16:41] [Core] [ERRO] [core.astr_agent_run_util:114]: Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\AstrBotLauncher-0.2.0\AstrBot\astrbot\core\astr_agent_run_util.py", line 48, in run_agent
async for resp in agent_runner.step():
File "C:\Users\Administrator\Desktop\AstrBotLauncher-0.2.0\AstrBot\astrbot\core\agent\runners\tool_loop_agent_runner.py", line 111, in step
async for llm_response in self._iter_llm_responses():
File "C:\Users\Administrator\Desktop\AstrBotLauncher-0.2.0\AstrBot\astrbot\core\agent\runners\tool_loop_agent_runner.py", line 88, in _iter_llm_responses
async for resp in stream: # type: ignore
File "C:\Users\Administrator\Desktop\AstrBotLauncher-0.2.0\AstrBot\astrbot\core\provider\sources\openai_source.py", line 576, in text_chat_stream
) = await self._handle_api_error(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\Desktop\AstrBotLauncher-0.2.0\AstrBot\astrbot\core\provider\sources\openai_source.py", line 467, in _handle_api_error
raise e
File "C:\Users\Administrator\Desktop\AstrBotLauncher-0.2.0\AstrBot\astrbot\core\provider\sources\openai_source.py", line 564, in text_chat_stream
async for response in self._query_stream(payloads, func_tool):
File "C:\Users\Administrator\Desktop\AstrBotLauncher-0.2.0\AstrBot\astrbot\core\provider\sources\openai_source.py", line 189, in _query_stream
stream = await self.client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\Desktop\AstrBotLauncher-0.2.0\AstrBot\venv\Lib\site-packages\openai\resources\chat\completions\completions.py", line 2603, in create
return await self._post(
^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\Desktop\AstrBotLauncher-0.2.0\AstrBot\venv\Lib\site-packages\openai_base_client.py", line 1794, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\Desktop\AstrBotLauncher-0.2.0\AstrBot\venv\Lib\site-packages\openai_base_client.py", line 1594, in request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': 'Missing reasoning_content field in the assistant message at message index 6. For more information, please refer to https://api-docs.deepseek.com/guides/thinking_mode#tool-calls', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
Are you willing to submit a PR? / 你愿意提交 PR 吗?
- Yes!
Code of Conduct
- I have read and agree to abide by the project's Code of Conduct。