[Bug]: 是用DeepSeek v4 flash和nex-agi/Nex-N2-Pro 作为VLM在v0.4.7都无法抽取有效内容
Bug Description
从v0.4.2升级到v0.4.6 就开始出问题,升级v0.4.7 因为无法解决。 所以利用hermes agent 对这个事情排查,给出的结论就是token用了,但实际没有抽取(抽取了有效内容,但被解释器忽略了)
系统,飞牛OS 1.2 Rockchip rk3566 4G ram
session-1773932332178-rw30kg
commit_count: 1 ✅
llm: prompt=3839 completion=2807 total=6646 ✅(VLM 跑了)
memories_extracted: total=0 ❌
*确认:还是没提取出来。* 和之前完全一样的模式 — 压缩阶段(Working Memory 生成)正常,但记忆抽取阶段 DeepSeek 的输出被解析器丢弃了。
现在回到你的问题:*要不要花时间折腾这个?*
你说得对,如果 OV 记忆抽取必须绑特定模型才工作,不值得。但这里不是绑定问题,是 *v0.4.7 memory v2 的 ReAct 管道对 DeepSeek 的输出格式兼容性不够好*。
VLM 用了两个都无法成功抽取,利用的是硅基流动的服务,之前有配置query_planner和现在不配置都一样。
Steps to Reproduce
就是一正常用,hermes agent (v0.18.0/v0.17.0)配置记忆插件就是openviking,正常用就发生
Expected Behavior
期待,能正常抽取有用的6类价值内容。
Actual Behavior
现在,不能抽取到有用价值内容。
Minimal Reproducible Example
Error Logs
``
WARNING agent.tool_executor: Tool skill_manage returned error (3.01s): {"success": false, "error": "Found 3 matches for old_string. Provide more context to make it unique, or use replace_all=True.", "file_preview": "---\nname: openviking-ops\ndescription: |\n 操作和调试 Open
WARNING agent.tool_executor: Tool skill_manage returned error (0.06s): {"success": false, "error": "old_string and new_string are identical", "file_preview": "---\nname: openviking-ops\ndescription: |\n 操作和调试 OpenViking 长期记忆服务(volcengine/OpenViking,HTTP API 默认 127.0.0.1
WARNING agent.tool_executor: Tool skill_manage returned error (0.35s): {"success": false, "error": "Could not find a match for old_string in the file\n\nDid you mean one of these sections?\n 56| | **🔴 VLM 记忆抽取失败(B 型:llm>0, me=0)** | VLM 已消耗 token 但 `memories_extracted.t
WARNING agent.tool_executor: Tool skill_manage returned error (1.05s): {"success": false, "error": "Could not find a match for old_string in the file\n\nDid you mean one of these sections?\n 56| | **🔴 VLM 记忆抽取失败(B 型:llm>0, me=0)** | VLM 已消耗 token 但 `memories_extracted.t
WARNING agent.tool_executor: Tool skill_manage returned error (0.98s): {"success": false, "error": "Could not find a match for old_string in the file\n\nDid you mean one of these sections?\n 56| | **🔴 VLM 记忆抽取失败(B 型:llm>0, me=0)** | VLM 已消耗 token 但 `memories_extracted.t
WARNING agent.tool_executor: Tool skill_manage returned error (1.03s): {"success": false, "error": "Could not find a match for old_string in the file\n\nDid you mean one of these sections?\n 56| | **🔴 VLM 记忆抽取失败(B 型:llm>0, me=0)** | VLM 已消耗 token 但 `memories_extracted.t
WARNING agent.tool_executor: Tool skill_manage returned error (0.79s): {"success": false, "error": "Found 3 matches for old_string. Provide more context to make it unique, or use replace_all=True.", "file_preview": "---\nname: openviking-ops\ndescription: |\n 操作和调试 Open
``
OpenViking Version
v0.4.7
Python Version
3.13.14
Operating System
Linux
Model Backend
None
Additional Context
No response
从v0.3.4 就开始用,做过迁移到0.4.2,然后到0.4.6再到0.4.7. 最正常用的时候是0.3.4。 在0.4.2时做了hermes 内置数据库session内容通过openviking plugin 导入到系统,导入后0.4.2 的时候还能搜,此时只会find,升级到0.4.6开始find和search会同时,而且search 时间会很长,一开始会超时60秒,发现是embedding 的最大请求token 超了,于是在ov文件中指定了模型的最大值,逐渐排查后search能正常了也要8~1x秒,此时我以为正常用。此时排查发现LLM用了token但无法抽取到有用的内容,抽取到都是0,升级到v0.4.7 仍然未解决。0.4.6还是0.4.7时,开机日志提示数据库少了一列content。
当前的ov 配置如下:hermes 使用的是一个user账号,hermes和openviking都是独立用docker部署。
{
"storage": {
"workspace": "/app/.openviking/data"
},
"embedding": {
"max_input_tokens": 8192,
"dense": {
"provider": "openai",
"model": "BAAI/bge-m3",
"api_key": "sk-aexxxxxxxxxxxxxxxxxxxxxxxxxxxxxkey",
"api_base": "https://api.siliconflow.cn/v1",
"dimension": 1024
}
},
"query_planner": {
"provider": "openai",
"model": "tencent/Hunyuan-MT-7B",
"api_key": "sk-aexxxxxxxxxxxxxxxxxxxxxxxxxxxxxkey",
"api_base": "https://api.siliconflow.cn/v1",
"temperature": 0.0,
"timeout": 30,
"extra_request_body": {
"max_tokens": 32767
}
},
"vlm": {
"provider": "openai",
"model": "deepseek-ai/DeepSeek-V4-Flash",
"api_key": "sk-aexxxxxxxxxxxxxxxxxxxxxxxxxxxxxkey",
"api_base": "https://api.siliconflow.cn/v1",
"temperature": 0.0,
"max_retries": 2
},
"rerank": {
"provider": "openai",
"model": "BAAI/bge-reranker-v2-m3",
"api_key": "sk-aeftxxxxxxxxxxxxxxxxxxxxxxxxxxxxxkey",
"api_base": "https://api.siliconflow.cn/v1/rerank",
"threshold": 0.1
},
"server": {
"host": "0.0.0.0",
"auth_mode": "api_key",
"root_api_key": "a4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxrootkey"
}
}
感谢补充信息。
从目前现象看,llm token 已消耗 只能说明记忆抽取阶段确实调用了 VLM/LLM,但不能说明模型输出已经被 OpenViking 的 memory v2 抽取管线成功接受。
memory v2 抽取阶段要求模型最终返回符合内部 JSON schema 的结构化 memory operations,或者按协议进行 tool call。如果模型返回了自然语言说明、markdown 包裹内容、字段不匹配的 JSON,或者没有按 schema 输出,即使 completion token 很多,最终也可能表现为:
llm: prompt/completion 有消耗
memories_extracted: total=0
所以这里需要先确认失败点到底是:
- 模型没有抽取出任何候选内容;
- 模型抽取了,但输出格式不符合 memory v2 schema;
- 输出格式基本正确,但某些字段、patch、URI 或 ranges 被后续校验忽略;
- 配置或历史数据迁移导致读取、合并、落盘阶段异常。
OpenViking 默认会优先以项目推荐/默认模型链路作为主要验证路径。第三方 OpenAI-compatible 模型,例如 DeepSeek、Nex、硅基流动上的不同模型,虽然可以尝试使用,但不同模型对 tool call / JSON schema 输出协议的遵循程度可能不一致,因此不一定能保证与默认链路表现完全相同。
可以先做三个排查:
-
如果方便,先临时切回默认/推荐的 doubao-seed 模型测试同一段 session commit。
如果 doubao-seed 能正常抽取,而 DeepSeek/Nex 抽取为 0,基本可以确认是模型输出协议兼容性或提示词适配问题。 -
提供一次失败 commit 附近的 debug 日志,重点是这些字段:
llm_response= Failed to parse memory operations failure_kind= response_preview= final_operations= memory_diff.json请注意隐藏 API key、用户隐私内容和敏感配置。
-
如果想验证是不是 memory schema 描述不够适配当前模型,可以用自定义 memory schema 做一次最小排查。建议优先使用
memory.custom_templates_dir,不要先改内置文件。例如在容器里准备目录:
/app/.openviking/custom-memory/从内置目录复制要调试的 schema,例如:
openviking/prompts/templates/memory/preferences.yaml放到:
/app/.openviking/custom-memory/preferences.yaml然后在配置里增加:
{ "memory": { "custom_templates_dir": "/app/.openviking/custom-memory" } }如果使用 docker compose,需要把宿主机目录挂进容器,例如:
volumes: - ./custom-memory:/app/.openviking/custom-memory注意:
memory.custom_templates_dir指向的目录下直接放preferences.yaml、profile.yaml这类文件,不需要再套一层memory/子目录。排查时建议只改低风险字段,例如
description和字段里的description:memory_type: preferences description: | User preference memory. Extract only durable user preferences explicitly stated by the user. Do not create a preference from temporary context. Keep each preference concise and specific. The final model response must still follow the required JSON schema; do not add analysis text outside JSON. fields: - name: user type: string description: Username for the preference owner merge_op: immutable - name: topic type: string description: Concise preference topic. merge_op: immutable - name: content type: string description: | Preference content in Markdown. Use one concise statement describing what the user prefers. merge_op: patch不建议在排查阶段修改这些结构字段:
memory_type directory filename_template fields.name fields.type merge_op修改后重启 OpenViking server,并检查日志中是否出现类似:
Loaded ... memory schemas from custom: /app/.openviking/custom-memory然后用一段很小的测试会话触发 commit,例如:
我以后更喜欢中文回答,代码解释短一点。再看
memories_extracted是否出现preferences。
补充说明:memory schema 自定义只能影响某类记忆的定义、字段描述和落盘模板,不能完全控制 memory v2 主抽取协议。如果模型最终仍然输出自然语言说明,而不是符合 schema 的 JSON operations,单靠改 schema 可能仍然无法解决。
目前还不能仅凭 token 用了但 memories_extracted=0 判断一定是 parser bug,还是模型输出没有遵守 memory v2 协议。需要 raw LLM response / parse failure 日志后,才能进一步判断这是配置问题、模型输出协议差异,还是项目侧需要讨论的通用兼容点。
如果有更清晰的反馈可以再reopen哈
补一个运维侧实测(自托管 v0.4.19,VLM 走 OpenAI 兼容网关 / OpenRouter,deepseek/deepseek-v4-flash-0731 且 reasoning.enabled=false):
结论:能抽,但偶发违反记忆 SDK 输出协议。
- 症状:任务
status=completed、result.memories_extracted={},对应归档memory_diff.json的 adds/updates/deletes 全 0、trace_id=null。 - 容器日志才是证据源:
extract_loop:run:420 - Failed to parse memory operations (iteration 4/4) failure_kind=parse_error;模型 content 里幻觉成别的框架(from memobase import Memobase/mb.create(...))或调用该类型不存在的sdk.set_events()(协议里 events 只能create_events())。注意这是 parse_error(有文本、不合协议),不是empty_response。 - 实测换该模型后 4 个实质会话中 2 个提取 0 条(含一个 133 条消息的大会话)。
一个有效规避:把单次提交的消息量压小。
同一会话整包重灌两次全废(一次 4/4 parse_error,一次把任务卡在 running、updated_at 冻结且容器日志与模型侧全静默);改成 ~45 条/块、每块单独 commit 后正常产出(0 → 14 条记忆)。看起来提取 prompt 随批次线性膨胀后,超大输入本身就会触发这类协议失败。
另:这类失败在服务端不可观测 —— 提取失败的记录不向上传播,所以「commit 成功 + 0 条记忆」只能靠外挂轮询 /api/v1/tasks 里 memories_extracted 合计为 0 的 session_commit 再补灌(相关可观测性缺口在 #4580 里被承认但未修)。