OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Question]: 执行用例example.py和basic_usage.py的问题

Open l2002924700 opened this issue 7 months ago • 2 comments

Your Question

你好,我想提取一段记忆,但是始终不成功,没有办法,只好反过来尝试example.py和basic_usage.py的执行。我的版本是0.3.8,因为0.3.8有bug,不能使用local模式,只能使用http模式,执行之后,分别得到如下结果:

python basic_usage.py

============================================================ OpenViking Basic Usage Example

  1. Initializing OpenViking...

16:56:08 - 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: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1010). Falling back to local backup. 2026-04-17 16:56:09,653 - openviking.pyagfs - INFO - Loaded RAGFS Rust binding 2026-04-17 16:56:09,665 - openviking.utils.agfs_utils - WARNING - [RAGFS] Using Rust binding (ragfs-python) 2026-04-17 16:56:09,666 - openviking.storage.queuefs.queue_manager - INFO - [QueueManager] Initialized with agfs=RAGFSBindingClient, mount_point=/queue 2026-04-17 16:56:09,666 - openviking.storage.viking_vector_index_backend - INFO - VikingVectorIndexBackend facade initialized 2026-04-17 16:56:09,687 - openviking.storage.queuefs.queue_manager - INFO - Embedding queue initialized with TextEmbeddingHandler 2026-04-17 16:56:09,688 - openviking.storage.queuefs.queue_manager - INFO - Semantic queue initialized with SemanticProcessor 2026-04-17 16:56:09,706 - openviking.service.core - INFO - Initialized embedder (dim 1024, sparse False) 2026-04-17 16:56:09,708 - openviking.crypto.config - INFO - Encryption is disabled 2026-04-17 16:56:09,708 - openviking.service.core - INFO - Encryption module not enabled 2026-04-17 16:56:09,708 - openviking.storage.viking_vector_index_backend - INFO - _SingleAccountBackend initialized (bound_account_id=default, mode=local) 2026-04-17 16:56:09,720 - openviking.storage.queuefs.queue_manager - INFO - [QueueManager] Started 2026-04-17 16:56:09,720 - openviking.service.core - INFO - QueueManager workers started 2026-04-17 16:56:09,720 - openviking.service.core - INFO - Initialized preset directories account=0 user=0 2026-04-17 16:56:09,739 - openviking.session - INFO - Using v2 memory compressor (templating system) 2026-04-17 16:56:09,740 - openviking.service.core - INFO - LockManager started 2026-04-17 16:56:09,740 - openviking.resource.watch_manager - INFO - [WatchManager] Loaded 0 tasks from storage 2026-04-17 16:56:09,740 - openviking.resource.watch_manager - INFO - [WatchManager] Initialized with 0 tasks 2026-04-17 16:56:09,740 - openviking.resource.watch_scheduler - INFO - [WatchScheduler] WatchManager initialized 2026-04-17 16:56:09,740 - openviking.resource.watch_scheduler - INFO - [WatchScheduler] Started with check interval 60.0s 2026-04-17 16:56:09,740 - openviking.service.core - INFO - WatchScheduler started 2026-04-17 16:56:09,740 - openviking.service.core - INFO - OpenVikingService initialized 2026-04-17 16:56:09,740 - openviking.resource.watch_scheduler - INFO - [WatchScheduler] Scheduler loop started Client initialized successfully Status: healthy

  1. Adding a resource (URL)...

2026-04-17 16:56:09,809 - openviking.telemetry.execution - INFO - Telemetry summary (id=tm_c3de6d9b968e458191914e49a1913460): {'operation': 'resources.add_resource', 'status': 'ok', 'duration_ms': 36.808, 'resource': {'request': {'duration_ms': 36.765}, 'process': {'duration_ms': 36.716}, 'flags': {'wait': False, 'build_index': True, 'summarize': False, 'watch_enabled': False}}} Root URI: Files indexed: 4

  1. Browsing the virtual filesystem...

  1. Waiting for semantic processing...

Processing complete: {'Embedding': {'processed': 0, 'requeue_count': 0, 'error_count': 0, 'errors': []}, 'Semantic': {'processed': 0, 'requeue_count': 0, 'error_count': 0, 'errors': []}}

  1. Tiered Context Loading (L0/L1/L2):

  1. Semantic Search:

  1. Content search (grep):

  1. Session Management (Demo):

2026-04-17 16:56:09,810 - openviking.session.session - INFO - Session created: 02b24b3e-5d44-4d92-8455-695255ed6b6a for user default:default:default Created session: 02b24b3e-5d44-4d92-8455-695255ed6b6a 2026-04-17 16:56:09,811 - openviking.session.session - INFO - Session created: 02b24b3e-5d44-4d92-8455-695255ed6b6a for user default:default:default 2026-04-17 16:56:09,811 - openviking.session.session - INFO - Session loaded: 02b24b3e-5d44-4d92-8455-695255ed6b6a (0 messages) 2026-04-17 16:56:09,814 - openviking.session.session - INFO - Session created: 02b24b3e-5d44-4d92-8455-695255ed6b6a for user default:default:default 2026-04-17 16:56:09,814 - openviking.session.session - INFO - Session loaded: 02b24b3e-5d44-4d92-8455-695255ed6b6a (1 messages) Added conversation turn (Session would be committed at conversation end)

  1. Closing OpenViking...

2026-04-17 16:56:09,816 - openviking.resource.watch_scheduler - INFO - [WatchScheduler] Scheduler loop ended 2026-04-17 16:56:09,816 - openviking.resource.watch_scheduler - INFO - [WatchScheduler] WatchManager cleaned up 2026-04-17 16:56:09,816 - openviking.resource.watch_scheduler - INFO - [WatchScheduler] Stopped 2026-04-17 16:56:09,816 - openviking.service.core - INFO - WatchScheduler stopped 2026-04-17 16:56:09,922 - openviking.storage.queuefs.queue_manager - INFO - [QueueManager] Stopped 2026-04-17 16:56:09,922 - openviking.service.core - INFO - Queue manager stopped 2026-04-17 16:56:09,923 - openviking.storage.viking_vector_index_backend - INFO - _SingleAccountBackend closed 2026-04-17 16:56:09,923 - openviking.storage.viking_vector_index_backend - INFO - VikingVectorIndexBackend facade closed 2026-04-17 16:56:09,923 - openviking.service.core - INFO - OpenVikingService closed Done!

============================================================ Example completed successfully!

python example.py

Error: 'root_uri'

这个结果正常吗? 我的配置文件如下:

{ "server": { "host": "127.0.0.1", "port": 1933, "root_api_key": null, "cors_origins": ["*"] }, "storage": { "workspace": "/home/OpenViking/data", "vectordb": { "name": "context", "backend": "local", "project": "default", "volcengine": { "region": "cn-beijing", "ak": null, "sk": null } }, "agfs": { "timeout": 10, "s3": { "bucket": null, "region": null, "access_key": null, "secret_key": null, "endpoint": null, "prefix": "", "use_ssl": true } } }, "memory":{ "version":"v2" }, "embedding": { "dense": { "provider": "ollama", "model": "Qwen3-Embedding-4B-Q4_K_M:latest", "api_base": "http://localhost:11434/v1", "dimension": 1024, "input": "text" } }, "vlm": { "model": "qwen3-vl:8b-instruct", "api_key": "ollama", "api_base": "http://localhost:11434/v1", "temperature": 0.0, "max_retries": 2, "provider": "openai", "thinking": false }, "log": { "level": "INFO", "output": "stdout" } }

如果,有问题,请问这个问题该怎么解决?

Context

No response

Code Example (Optional)


Related Area

None

Before Asking

l2002924700 avatar Apr 17 '26 08:04 l2002924700

  • example.py 里报 Error: 'root_uri' ,看起来不是用法问题,更像是 add_resource() 返回结果异常。
  • 按当前代码逻辑,资源导入成功后结果里应该包含 root_uri ;如果没有,一般说明导入流程前面某一步已经失败了,只是 example.py 直接取 add_result['root_uri'] ,把真正错误信息遮住了。
  • basic_usage.py 之所以没有直接报错,是因为它用了 result.get("root_uri", "") ,所以会把同样的问题表现成“ Root URI 为空、后续结果也基本为空”,看起来像跑通了,其实并没有真正完成资源导入

sponge225 avatar Apr 17 '26 10:04 sponge225

这里先关闭。这个现象不是正常结果:root_uri 为空 / Error: 'root_uri' 说明 add_resource() 前面已经失败了,只是示例代码把真正的导入错误遮住了。

这个 issue 是 0.3.8 的旧版本问题;当前仓库里也没有同名的 examples/example.py 可继续定位。如果最新版还能复现,请重新开一个更聚焦的 issue,附上:

  • 当前 OpenViking 版本;
  • add_resource() 的完整返回值;
  • server 侧第一次失败日志;
  • 使用的是 embedded 还是 HTTP client mode。

这样可以直接判断是资源导入失败、配置问题,还是示例代码需要再改错误展示。

ZaynJarvis avatar May 31 '26 10:05 ZaynJarvis