OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Question]: 使用 "memory":{ "version":"v2" }的问题

Open l2002924700 opened this issue 7 months ago • 7 comments

Your Question

您好,当我使用 "memory":{ "version":"v2" }的时候,执行代码后,会报下面的错误:

File "lib/python3.12/site-packages/openviking/session/compressor_v2.py", line 168, in extract_long_term_memories operations, tools_used = await orchestrator.run() ^^^^^^^^^^^^^^^^^^^^^^^^ File "lib/python3.12/site-packages/openviking/session/memory/extract_loop.py", line 189, in run tool_calls, operations = await self._call_llm(messages, force_final=is_last_iteration) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "lib/python3.12/site-packages/openviking/session/memory/extract_loop.py", line 324, in _call_llm response = await self.vlm.get_completion_async( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: OpenAIVLM.get_completion_async() got an unexpected keyword argument 'max_retries'

请问出现这个错误的原因是啥?该如何解决呢?

Context

我想使用"memory":{ "version":"v2" }

Code Example (Optional)

import openviking as ov
from openviking.message import TextPart
from pathlib import Path
import shutil

dir_path = Path("./color_data")
# 删除目录及其所有内容
if dir_path.exists():
    shutil.rmtree(dir_path)
    print(f"已删除空目录: {dir_path}")


client = ov.OpenViking(path="./color_data")
client.initialize()

session = client.session()
session.add_message("user", [TextPart(text="User likes the color blue.")])

commit_result = session.commit()

# 等待后台的记忆提取 / 索引完成
client.wait_processed()

#print(f"commit_result:{commit_result}")

results = client.search(
    query="What color does the user like?",
    #target_uri="viking://session/",
    session=session,
)


#results = client.find(
#    query="What color does the user like?",
#    target_uri="viking://sessions/",
#)

#print(f"results: {results}")
import pdb
pdb.set_trace()
print(f"memories: {len(results.memories)}")
for mem in results.memories:
    print(f"Found: {mem.uri}")
    print(f"Abstract: {mem.abstract}")
    print(f"Content: {client.read(mem.uri)[:200]}...")

client.close()

Related Area

None

Before Asking

l2002924700 avatar Apr 13 '26 01:04 l2002924700

请问是用的哪个ov版本呢

sponge225 avatar Apr 13 '26 03:04 sponge225

请问是用的哪个ov版本呢 0.3.3 您好,我是如下:

openviking-server --version 12:03:09 - LiteLLM:WARNING: get_model_cost_map.py:271 - LiteLLM: Failed to fetch remote model cost map from https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json: [Errno 101] Network is unreachable. Falling back to local backup. openviking-server 0.3.3

l2002924700 avatar Apr 13 '26 04:04 l2002924700

Thanks for reporting this!

我们检查了一下,这个报错的根因是 memory v2 这条路径里,旧版本的 ExtractLoop._call_llm() 还会把 max_retries 继续透传给 get_completion_async();但在后续的重试逻辑重构之后,重试已经下沉到 VLM provider 内部处理了,这个参数不应该再由调用方传递,所以会触发 TypeError: ... got an unexpected keyword argument 'max_retries'。

结论是:当前最新代码(main)里这条路径已经修复,不会再传这个参数了;但你本地安装的发布版本如果还没包含这个改动,仍然会遇到这个问题。

如果你现在想先绕过这个问题,有两个办法:

  1. 直接使用仓库当前最新代码安装。
  2. 等下一个包含该修复的发布版本。

如果你愿意的话,也可以贴一下你当前安装的 openviking 版本号,我们可以帮你一起确认是否正好落在这个问题影响的版本范围内。

qin-ctx avatar Apr 13 '26 07:04 qin-ctx

是最新代码么? 这个问题我记得一已经修了

chenjw avatar Apr 13 '26 08:04 chenjw

是最新代码么? 这个问题我记得一已经修了

是0.3.3版本

l2002924700 avatar Apr 13 '26 11:04 l2002924700

是最新代码么? 这个问题我记得一已经修了

是0.3.3版本

用最新版本试试? 这个bug主干代码上已经修复了

chenjw avatar Apr 13 '26 17:04 chenjw

是最新代码么? 这个问题我记得一已经修了

是0.3.3版本

用最新版本试试? 这个bug主干代码上已经修复了

你好,升级到0.3.5版本之后,会出现如下的错误:

2026-04-14 08:06:28,338 - openviking.storage.queuefs.queue_manager - INFO - [QueueManager] Initialized with agfs=RAGFSBindingClient, mount_point=/queue 2026-04-14 08:06:28,338 - openviking.storage.viking_vector_index_backend - INFO - VikingVectorIndexBackend facade initialized 2026-04-14 08:06:28,356 - openviking.storage.queuefs.queue_manager - INFO - Embedding queue initialized with TextEmbeddingHandler 2026-04-14 08:06:28,356 - openviking.storage.queuefs.queue_manager - INFO - Semantic queue initialized with SemanticProcessor 2026-04-14 08:06:28,374 - openviking.service.core - INFO - Initialized embedder (dim 1024, sparse False) 2026-04-14 08:06:28,376 - openviking.crypto.config - INFO - Encryption is disabled 2026-04-14 08:06:28,376 - openviking.service.core - INFO - Encryption module not enabled 2026-04-14 08:06:28,377 - openviking.storage.viking_vector_index_backend - INFO - _SingleAccountBackend initialized (bound_account_id=default, mode=local) 2026-04-14 08:06:28,391 - openviking.storage.viking_vector_index_backend - INFO - Created collection: context 2026-04-14 08:06:28,392 - openviking.storage.queuefs.queue_manager - INFO - [QueueManager] Started 2026-04-14 08:06:28,392 - openviking.service.core - INFO - QueueManager workers started 2026-04-14 08:06:28,400 - openviking.service.core - INFO - Initialized preset directories account=4 user=5 2026-04-14 08:06:28,419 - openviking.session - INFO - Using v2 memory compressor (templating system) 2026-04-14 08:06:28,419 - openviking.service.core - INFO - LockManager started 2026-04-14 08:06:28,419 - openviking.resource.watch_manager - INFO - [WatchManager] Loaded 0 tasks from storage 2026-04-14 08:06:28,419 - openviking.resource.watch_manager - INFO - [WatchManager] Initialized with 0 tasks 2026-04-14 08:06:28,419 - openviking.resource.watch_scheduler - INFO - [WatchScheduler] WatchManager initialized 2026-04-14 08:06:28,419 - openviking.resource.watch_scheduler - INFO - [WatchScheduler] Started with check interval 60.0s 2026-04-14 08:06:28,419 - openviking.service.core - INFO - WatchScheduler started 2026-04-14 08:06:28,419 - openviking.service.core - INFO - OpenVikingService initialized 2026-04-14 08:06:28,419 - openviking.resource.watch_scheduler - INFO - [WatchScheduler] Scheduler loop started 2026-04-14 08:06:28,420 - openviking.session.session - INFO - Session created: 5e0aa4b1-189f-4e18-801d-e46fd4302916 for user default:default:default 2026-04-14 08:06:28,420 - openviking.storage.viking_fs - ERROR - [VikingFS] Failed to append to file viking://session/default/5e0aa4b1-189f-4e18-801d-e46fd4302916/messages.jsonl: not found: /default/session/default/5e0aa4b1-189f-4e18-801d-e46fd4302916/messages.jsonl Traceback (most recent call last): File "/lib/python3.12/site-packages/openviking/storage/viking_fs.py", line 1719, in append_file existing_bytes = self._handle_agfs_read(self.agfs.read(path)) ^^^^^^^^^^^^^^^^^^^^ RuntimeError: not found: /default/session/default/5e0aa4b1-189f-4e18-801d-e46fd4302916/messages.jsonl

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/test_openviking/test_session_color.py", line 17, in session.add_message("user", [TextPart(text="User likes the color blue.")]) File "/lib/python3.12/site-packages/openviking/session/session.py", line 320, in add_message self._append_to_jsonl(msg) File "/lib/python3.12/site-packages/openviking/session/session.py", line 1294, in _append_to_jsonl run_async( File "/lib/python3.12/site-packages/openviking_cli/utils/async_utils.py", line 97, in run_async return future.result() ^^^^^^^^^^^^^^^ File "/lib/python3.12/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/lib/python3.12/site-packages/openviking/storage/viking_fs.py", line 1735, in append_file raise IOError(f"Failed to append to file {uri}: {e}") OSError: Failed to append to file viking://session/default/5e0aa4b1-189f-4e18-801d-e46fd4302916/messages.jsonl: not found: /default/session/default/5e0aa4b1-189f-4e18-801d-e46fd4302916/messages.jsonl 2026-04-14 08:06:28,595 - openviking.storage.queuefs.queue_manager - INFO - [QueueManager] Stopped Task was destroyed but it is pending! task: <Task pending name='Task-6' coro=<WatchScheduler._run_scheduler() running at /lib/python3.12/site-packages/openviking/resource/watch_scheduler.py:165> wait_for=>

这个怎么解决呢?

l2002924700 avatar Apr 14 '26 00:04 l2002924700