AstrBot icon indicating copy to clipboard operation
AstrBot copied to clipboard

[Bug] Error occurred while adding embedding model, Documents may need update.

Open inertialobs opened this issue 5 months ago • 2 comments

What happened / 发生了什么

按照文档指示的操作添加嵌入模型,在测试时发生异常 Error code: 400 - {'code': 20015, 'message': 'The parameter is invalid. Please check again.', 'data': None}, 具体内容见日志

Reproduce / 如何复现?

填写 AstrBot OpenAI Embedding 模型提供商配置: embedding api base 填写 https://api.siliconflow.cn/v1 model 填写你选择的模型,此例子中为 BAAI/bge-m3 选择保存并测试,或者直接选择获取维度

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

Astrbot v4,25,2 Linux 手动部署 平台适配器时OneBot (不过似乎无关此问题?) 具体的部署平台时Debian 13 aarch64

OS

Linux

Logs / 报错日志

[v4.25.2] [routes.config:907]: Traceback (most recent call last):
  File "/home/admin/Astrbot/astrbot/dashboard/routes/config.py", line 898, in get_embedding_dim
    vec = await inst.get_embedding("echo")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/admin/Astrbot/astrbot/core/provider/sources/openai_embedding_source.py", line 48, in get_embedding
    embedding = await self.client.embeddings.create(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
    )
    ^
  File "/home/admin/Astrbot/.venv/lib/python3.13/site-packages/openai/resources/embeddings.py", line 251, in create
    return await self._post(
           ^^^^^^^^^^^^^^^^^
    ...<10 lines>...
    )
    ^
  File "/home/admin/Astrbot/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1794, in post
    return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/admin/Astrbot/.venv/lib/python3.13/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 - {'code': 20015, 'message': 'The parameter is invalid. Please check again.', 'data': None}

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • [ ] Yes!

Code of Conduct

inertialobs avatar Jun 13 '26 13:06 inertialobs

Hi @NonInertialObserver! I'm Dosu and I'm helping the AstrBotTeam team.

这是一个已确认的兼容性问题。原因是 AstrBot 在调用硅基流动 API 时传递了 dimensions 参数,但 BAAI/bge-m3 等非 Qwen 系列模型不支持该参数,导致返回 400 错误 [1]。

该问题已在 PR #8508 中修复,修复逻辑为:当检测到 API 地址为硅基流动且模型非 Qwen 系列时,自动移除 dimensions 参数 [2]。

临时解决方案:

  1. 推荐: 改用硅基流动支持 dimensions 参数的 Qwen 系列嵌入模型(如 Qwen/Qwen3-Embedding-0.6B),保持 1024 维配置即可正常使用。
  2. 升级到包含该修复的更新版本(v4.25.2 之后的版本应已包含此修复,请确认是否有更新可用)。

注意:将嵌入维度留空虽然测试能通过,但会导致已建立的知识库因维度不匹配而无法正常查询 [1]。

To reply, just mention @dosu.


Share context across your team and agents. Try Dosu.

Leave Feedback Learn about AstrBot with Dosu Add Dosu to your team

dosubot[bot] avatar Jun 13 '26 13:06 dosubot[bot]

更新到v4.25.5后解决

inertialobs avatar Jun 13 '26 13:06 inertialobs