OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug]: 使用ov chat后提示报错

Open yuanhechen opened this issue 8 months ago • 9 comments

Bug Description

使用ov chat后发送消息无法正确返回消息,提示系统提示词应该在用户消息后面

Steps to Reproduce

1、安装openviking 2、安装openviking-bot 3、配置本地部署的qwen3-embedding模型和qwen3.5的推理服务,修改配置文件 4、启动openviking-server --with-bot 5、在另一个端口启动ov chat然后输入问题后不能正常返回内容

Expected Behavior

应该返回response

Actual Behavior

Error calling LLM: litellm.BadRequestError: OpenAIException - System message must be at the beginning.

Minimal Reproducible Example


Error Logs

2026-03-18 12:03:38.377 | INFO     | vikingbot.channels.manager:add_channel:36 - Channel added: openapi (cli__default)
2026-03-18 12:03:38.377 | INFO     | vikingbot.cli.commands:prepare_channel:432 - OpenAPI channel enabled on port 18790
✓ Channels enabled: cli__default
2026-03-18 12:03:38.379 | WARNING  | vikingbot.cli.commands:prepare_agent_loop:297 - [SANDBOX] disabled (using DIRECT mode - commands run directly on host)
2026-03-18 12:03:38.380 | WARNING  | vikingbot.integrations.langfuse:get_instance:69 - [LANGFUSE] disabled
2026-03-18 12:03:38.380 | DEBUG    | vikingbot.hooks.manager:register_path:44 - Registered hook '<vikingbot.hooks.builtins.openviking_hooks.OpenVikingCompactHook object at 0x7428a71a0490>' for event 'message.compact'
2026-03-18 12:03:38.380 | DEBUG    | vikingbot.hooks.manager:register_path:44 - Registered hook '<vikingbot.hooks.builtins.openviking_hooks.OpenVikingPostCallHook object at 0x7428a71a04c0>' for event 'tool.post_call'
✓ Heartbeat: every 600s
2026-03-18 12:03:38.382 | INFO     | vikingbot.cron.service:start:156 - Cron service started with 0 jobs
2026-03-18 12:03:38.382 | INFO     | vikingbot.heartbeat.service:start:109 - Heartbeat started (every 600s)
2026-03-18 12:03:38.382 | INFO     | vikingbot.channels.manager:start_all:188 - Starting cli__default channel...
2026-03-18 12:03:38.382 | INFO     | vikingbot.agent.loop:run:189 - Agent loop started
INFO:     Started server process [432774]
INFO:     Waiting for application startup.
2026-03-18 12:03:38.393 | INFO     | vikingbot.channels.manager:_dispatch_outbound:216 - Outbound dispatcher started
2026-03-18 12:03:38.402 | INFO     | vikingbot.channels.openapi:_setup_routes:265 - OpenAPI routes registered at root path
2026-03-18 12:03:38.402 | INFO     | vikingbot.channels.openapi:start:103 - OpenAPI channel started
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:18790 (Press CTRL+C to quit)
INFO:     127.0.0.1:44632 - "POST /bot/v1/chat/stream HTTP/1.1" 200 OK
2026-03-18 12:03:50.118 | INFO     | vikingbot.agent.loop:_process_message:426 - Processing message from type='cli' channel_id='default' chat_id='d0b12c2623f54261a54be695bed7a525':cli_user: hello
2026-03-18 12:03:50.166 | INFO     | vikingbot.agent.context:build_system_prompt:143 - [READ_USER_PROFILE]: cost 0.05s, profile=None
2026-03-18 12:03:50.544 | INFO     | vikingbot.agent.memory:get_viking_memory_context:61 - [USER_MEMORY]: search success. res: 1. User's personalized preference memories. Stores preferences by topic (communication style, code s. cost 0.34
2026-03-18 12:03:50.544 | INFO     | vikingbot.agent.context:_build_user_memory:176 - [READ_USER_MEMORY]: cost 0.38s, memory=### user memories:
1. User's personalized preferen
2026-03-18 12:03:50.662 | INFO     | vikingbot.agent.loop:_process_message:501 - Response to type='cli' channel_id='default' chat_id='d0b12c2623f54261a54be695bed7a525': Error calling LLM: litellm.BadRequestError: OpenAIException - System message must be at the beginning.

OpenViking Version

0.2.1

Python Version

3.10.20

Operating System

Linux

Model Backend

OpenAI

Additional Context

No response

yuanhechen avatar Mar 18 '26 04:03 yuanhechen

@yeshion23333 帮看下,可以先改成usermessage

chenjw avatar Mar 18 '26 04:03 chenjw

这个bug你们要修复吗

yuanhechen avatar Mar 18 '26 05:03 yuanhechen

这个bug你们要修复吗

今天修复

yeshion23333 avatar Mar 18 '26 06:03 yeshion23333

@yuanhechen can i see your local host vlm qwen3.5 configuration? I also host qwen3-vl-embedding as embed model and qwen3.5 as vlm model and I get the same error as you did when using ov chat

Error calling LLM: litellm.BadRequestError: OpenAIException - System message must be at the beginning.

For openviking I am using Python 3.12.3 and openviking version 0.2.13

For local vlm model I am using this image rocm/vllm-dev:nightly with below config python -m vllm.entrypoints.openai.api_server --model /models/Qwen3.5-122B-A10B --tensor-parallel-size 4 --port 8194 --served-model-name Qwen3.5-122B-A10B --enable-auto-tool-choice --tool-call-parser qwen3_coder

hoatungduong12 avatar Mar 26 '26 10:03 hoatungduong12

@yuanhechen can i see your local host vlm qwen3.5 configuration? I also host qwen3-vl-embedding as embed model and qwen3.5 as vlm model and I get the same error as you did when using ov chat

Error calling LLM: litellm.BadRequestError: OpenAIException - System message must be at the beginning.

For openviking I am using Python 3.12.3 and openviking version 0.2.13

For local vlm model I am using this image rocm/vllm-dev:nightly with below config python -m vllm.entrypoints.openai.api_server --model /models/Qwen3.5-122B-A10B --tensor-parallel-size 4 --port 8194 --served-model-name Qwen3.5-122B-A10B --enable-auto-tool-choice --tool-call-parser qwen3_coder

这个问题跟你的模型没关系,是openviking这个包的问题,在带工具的多轮对话时,多了system prompt,不符合openai接口的格式,不知道为啥这个bug一直不修

yuanhechen avatar Mar 27 '26 03:03 yuanhechen

这个bug你们要修复吗

今天修复

这个bug一直没修复。。。。。今天还是有这个报错

yuanhechen avatar Mar 27 '26 03:03 yuanhechen

这个bug你们要修复吗

今天修复

这个bug一直没修复。。。。。今天还是有这个报错

刚提了一版fix,由system 改为 user了,有时间的话,辛苦帮在最新main分支用qwen验证下哈

yeshion23333 avatar Mar 27 '26 03:03 yeshion23333

I build the latest version openviking 0.2.16.dev0 and now it get this error when using ov chat Error: API error: Request failed (401 Unauthorized): {"detail":"Missing authentication token"}

Image

In ov.conf I just config "storage", "log", "embedding" and "vlm", in ovcli.conf I config like this { "url": "http://127.0.0.1:1933", "timeout": 60.0 } ov status, ov add-resource, ov find still work normally

Image

Is there a bug in http client for bot?

hoatungduong12 avatar Mar 30 '26 10:03 hoatungduong12

I build the latest version openviking 0.2.16.dev0 and now it get this error when using ov chat Error: API error: Request failed (401 Unauthorized): {"detail":"Missing authentication token"}

Image In ov.conf I just config "storage", "log", "embedding" and "vlm", in ovcli.conf I config like this { "url": "http://127.0.0.1:1933", "timeout": 60.0 } ov status, ov add-resource, ov find still work normally Image Is there a bug in http client for bot?

This is indeed an issue. It may be related to the recently added API key verification PR. We will conduct a full verification and fix it shortly. https://github.com/volcengine/OpenViking/pull/996

yeshion23333 avatar Mar 30 '26 11:03 yeshion23333