repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
OpenViking | tests/models/vlm/test_timeout_config.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for ``vlm.timeout`` configuration propagation.
Before this was wired through, ``_build_openai_client_kwargs`` exposed a
``timeout`` parameter (#1208) but callers never passed it, so the default
timeout was alw... | 140 | 4,157 |
OpenViking | tests/misc/test_pyagfs_loader.py | .py | import sysconfig
import openviking.pyagfs as pyagfs
def test_find_ragfs_so_rejects_mismatched_cpython_binary(tmp_path, monkeypatch):
monkeypatch.setattr(pyagfs, "_LIB_DIR", tmp_path)
monkeypatch.setattr(
sysconfig, "get_config_var", lambda name: ".cpython-312-x86_64-linux-gnu.so"
)
(tmp_path... | 57 | 1,994 |
OpenViking | tests/misc/test_retrieval_enable_intent.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import contextvars
from unittest.mock import AsyncMock, MagicMock
import pytest
from openviking.server.identity import RequestContext, Role
from openviking.storage.viking_fs import VikingFS
from openviking_cli.retrie... | 142 | 4,944 |
OpenViking | tests/misc/test_semantic_config.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for SemanticConfig and overview budget estimation."""
import pytest
from openviking_cli.utils.config.parser_config import SemanticConfig
def test_semantic_config_defaults():
"""Test default values matc... | 108 | 3,981 |
OpenViking | tests/misc/test_code_parser.py | .py | #!/usr/bin/env python3
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Test CodeRepositoryParser functionality and compliance with README.md requirements"""
import os
import sys
from pathlib import Path
# Add parent directory to path to import openviking
sys.pat... | 232 | 7,489 |
OpenViking | tests/misc/test_x86_profiles.py | .py | from build_support.x86_profiles import get_host_engine_build_config
def test_x86_host_uses_sse3_extension_baseline():
config = get_host_engine_build_config("x86_64")
assert config.primary_extension == "openviking.storage.vectordb.engine._x86_sse3"
assert config.cmake_variants == ("sse3", "avx2", "avx512"... | 18 | 624 |
OpenViking | tests/misc/test_mkdir.py | .py | #!/usr/bin/env python3
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for VikingFS.mkdir() — verifies the target directory is actually created
and that backend errors are propagated instead of silently swallowed."""
import contextvars
import os
import sys
... | 121 | 4,672 |
OpenViking | tests/misc/test_vectordb_engine_loader.py | .py | import importlib
import importlib.util
import platform
import sys
import types
from pathlib import Path
import pytest
REPO_ROOT = Path(__file__).resolve().parents[2]
ENGINE_INIT = REPO_ROOT / "openviking" / "storage" / "vectordb" / "engine" / "__init__.py"
def _install_package_stubs(monkeypatch):
packages = {
... | 204 | 7,358 |
OpenViking | tests/misc/test_media_processor_zip_root.py | .py | #!/usr/bin/env python3
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for ZipParser single-root directory handling.
Verifies that ZipParser correctly handles:
1. ZIP with single top-level directory -> uses that directory name
2. ZIP with multiple top-level... | 350 | 13,542 |
OpenViking | tests/misc/test_process_lock.py | .py | """Tests for PID-based advisory lock on data directories."""
import os
import tempfile
from openviking.utils.process_lock import (
LOCK_FILENAME,
DataDirectoryLocked,
acquire_data_dir_lock,
)
class TestProcessLock:
def test_acquires_lock_on_empty_dir(self):
with tempfile.TemporaryDirectory()... | 62 | 2,349 |
OpenViking | tests/misc/test_resource_processor_mv.py | .py | import os
import sys
from types import SimpleNamespace
from unittest.mock import AsyncMock, MagicMock
import pytest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
class _DummyVikingDB:
def get_embedder(self):
return None
class _DummyTelemetry:
def ... | 383 | 12,848 |
OpenViking | tests/misc/test_zip_safe.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for zip_safe Zip Slip protection and filename normalization."""
from __future__ import annotations
import io
import stat
import zipfile
from pathlib import Path
import pytest
from openviking.utils.zip_safe ... | 393 | 15,713 |
OpenViking | tests/misc/test_release_tag_selection.py | .py | import sys
from pathlib import Path
from types import ModuleType
ROOT = Path(__file__).resolve().parents[2]
def test_main_package_versioning_ignores_non_main_release_tags() -> None:
pyproject = (ROOT / "pyproject.toml").read_text()
assert 'tag_regex = "^v(?P<version>[0-9]+(?:\\\\.[0-9]+)*)$"' in pyproject
... | 47 | 1,548 |
OpenViking | tests/misc/test_vikingdb_content_backfill.py | .py | import asyncio
import pytest
from scripts.maintenance.vikingdb_content_backfill import (
backfill_vikingdb_content as backfill,
)
class FailingAgfs:
def ls(self, _path):
raise OSError("storage unavailable")
class FailingSource:
async def tree(self, *_args, **_kwargs):
raise OSError("tr... | 69 | 1,930 |
OpenViking | tests/misc/test_docker_workflow_native_multiarch.py | .py | from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[2]
def _read_text(relative_path: str) -> str:
return (REPO_ROOT / relative_path).read_text(encoding="utf-8")
def test_build_docker_workflow_uses_native_parallel_multiarch_jobs():
workflow = _read_text(".github/workflows/build-docker-imag... | 97 | 4,104 |
OpenViking | tests/misc/test_config_validation.py | .py | #!/usr/bin/env python3
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Test if config validators work correctly"""
import sys
from pathlib import Path
import pytest
from openviking.utils.agfs_utils import (
RagfsBindingConfig,
_generate_plugin_config,
... | 1,091 | 35,744 |
OpenViking | tests/misc/test_models_observer.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Focused tests for model status observability."""
from openviking.storage.observers.models_observer import ModelsObserver
class _ConfiguredVLM:
model = "astron-code-latest"
provider = "litellm"
def get... | 35 | 1,051 |
OpenViking | tests/misc/test_extract_zip.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for CodeRepositoryParser._extract_zip Zip Slip protection."""
import io
import os
import stat
import zipfile
from pathlib import Path
import pytest
from openviking.parse.parsers.code.code import CodeReposito... | 171 | 6,782 |
OpenViking | tests/misc/test_abi3_packaging_config.py | .py | from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[2]
def _read_text(relative_path: str) -> str:
return (REPO_ROOT / relative_path).read_text(encoding="utf-8")
def test_packaging_only_includes_abi3_engine_extensions():
setup_py = _read_text("setup.py")
pyproject = _read_text("pyproje... | 129 | 4,894 |
OpenViking | tests/misc/test_ragfs_python_manifest_isolation.py | .py | import re
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def _read(path: Path) -> str:
return path.read_text(encoding="utf-8")
def _array_items(text: str, key: str) -> set[str]:
match = re.search(rf"{key}\s*=\s*\[(.*?)\]", text, flags=re.DOTALL)
assert match is not None, f"{key} ar... | 70 | 2,460 |
OpenViking | tests/misc/test_vikingfs_find_without_rerank.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Regression test for VikingFS.find without rerank configuration."""
import contextvars
from unittest.mock import MagicMock
import pytest
from openviking.server.identity import RequestContext, Role
from openviking.s... | 155 | 5,165 |
OpenViking | tests/misc/test_vikingfs_uri_guard.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Regression tests for traversal-style URI rejection in VikingFS."""
import contextvars
from unittest.mock import AsyncMock, MagicMock
import pytest
from openviking.pyagfs.exceptions import AGFSInvalidOperationError... | 319 | 11,976 |
OpenViking | tests/misc/test_embedding_input_type.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for non-symmetric query/document embedding passthrough.
Tests EmbeddingConfig's ability to create context-specific embedders:
- OpenAI: fixed query input_type when document input_type is set
- Jina: fixed quer... | 237 | 9,308 |
OpenViking | tests/misc/test_rerank_openai.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for OpenAI-compatible rerank client and factory dispatch."""
from unittest.mock import MagicMock, patch
import pytest
from pydantic import ValidationError
from openviking.models.rerank import OpenAIRerankCli... | 278 | 10,135 |
OpenViking | tests/misc/test_network_guard.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for network_guard SSRF protection utilities."""
from __future__ import annotations
from types import SimpleNamespace
from unittest.mock import AsyncMock, patch
import pytest
from openviking.utils.network_gu... | 334 | 13,030 |
OpenViking | tests/misc/test_mpeg_ts_media_utils.py | .py | from openviking.parse.parsers.media.utils import (
MPEG_TS_PACKET_SIZE,
MPEG_TS_PROBE_BYTES,
get_media_type,
is_mpeg_ts,
read_mpeg_ts_probe,
)
def mpeg_ts_probe() -> bytes:
content = bytearray(MPEG_TS_PROBE_BYTES)
for offset in range(0, MPEG_TS_PROBE_BYTES, MPEG_TS_PACKET_SIZE):
co... | 52 | 1,498 |
OpenViking | tests/misc/test_tree_builder_dedup.py | .py | #!/usr/bin/env python3
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for TreeBuilder final URI metadata."""
import os
import sys
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.pa... | 190 | 7,801 |
OpenViking | tests/misc/test_ovpack_import_policy.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Security regression tests for ovpack import target-policy enforcement."""
from __future__ import annotations
import hashlib
import json
import os
import tempfile
import zipfile
from pathlib import Path
from unittes... | 1,067 | 34,018 |
OpenViking | tests/misc/test_bot_dependency_compatibility.py | .py | """Regression checks for dependencies shared by the bot extra."""
import re
from pathlib import Path
import charset_normalizer
import requests
import urllib3
ROOT = Path(__file__).resolve().parents[2]
def _locked_version(package: str) -> str:
lock = (ROOT / "uv.lock").read_text()
match = re.search(
... | 32 | 891 |
OpenViking | tests/misc/test_root_docker_image_packaging.py | .py | import re
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[2]
def _read_text(relative_path: str) -> str:
return (REPO_ROOT / relative_path).read_text(encoding="utf-8")
def _extract_rust_version(pattern: str, text: str) -> str:
match = re.search(pattern, text, re.MULTILINE)
assert m... | 114 | 3,882 |
OpenViking | tests/misc/test_debug_service.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Tests for DebugService and ObserverService.
"""
from unittest.mock import MagicMock, patch
from openviking.service.debug_service import (
ComponentStatus,
DebugService,
ObserverService,
SystemStatu... | 454 | 18,204 |
OpenViking | scripts/maintenance/vikingdb_content_backfill/backfill_vikingdb_content.py | .py | #!/usr/bin/env python3
"""Backfill VikingDB content fields from Local AGFS source data."""
from __future__ import annotations
import argparse
import asyncio
import hashlib
import json
import sys
from dataclasses import dataclass
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
... | 676 | 24,766 |
OpenViking | build_support/x86_profiles.py | .py | from __future__ import annotations
import os
from dataclasses import dataclass
from typing import Iterable
DEFAULT_X86_VARIANTS = ("sse3", "avx2", "avx512")
KNOWN_X86_VARIANTS = frozenset(DEFAULT_X86_VARIANTS)
X86_ARCHITECTURES = ("x86_64", "amd64", "x64", "i386", "i686")
@dataclass(frozen=True)
class EngineBuildCo... | 65 | 1,916 |
OpenViking | build_support/versioning.py | .py | from __future__ import annotations
import os
from pathlib import Path
from typing import Mapping
SCM_TAG_REGEX = r"^v(?P<version>[0-9]+(?:\.[0-9]+)*)$"
SCM_GIT_DESCRIBE_COMMAND = "git describe --dirty --tags --long --match v[0-9]*"
PROJECT_ROOT = Path(__file__).resolve().parent.parent
def _get_scm_version(project_r... | 37 | 1,097 |
OpenViking | benchmark/locomo/hermes/stat_judge_result.py | .py | from __future__ import annotations
import argparse
import csv
import os
import sqlite3
from collections import defaultdict
from dataclasses import dataclass
from pathlib import Path
HERMES_USAGE_KEYS = [
"input_tokens",
"output_tokens",
"cache_read_tokens",
"cache_write_tokens",
"reasoning_tokens"... | 584 | 19,125 |
OpenViking | benchmark/locomo/hermes/judge.py | .py | import argparse
import asyncio
import csv
import json
import os
import sys
from pathlib import Path
from openai import AsyncOpenAI
try:
from dotenv import load_dotenv
except ImportError:
def load_dotenv(*_args, **_kwargs):
return False
env_file = Path.home() / ".openviking_benchmark_env"
load_doten... | 238 | 9,390 |
OpenViking | benchmark/locomo/hermes/import_e2e.py | .py | """
Hermes E2E memory ingest tool for mixed native and OpenViking memory.
"""
from __future__ import annotations
import argparse
import asyncio
import csv
import json
import os
import sys
import time
from datetime import datetime
from pathlib import Path
import httpx
import requests
try:
from dotenv import load... | 999 | 35,853 |
OpenViking | benchmark/locomo/hermes/import_to_ov.py | .py | """
OpenViking data import tool for LoCoMo benchmark.
"""
from __future__ import annotations
import argparse
import asyncio
import csv
import json
import os
import sys
import traceback
from datetime import datetime, timedelta
from pathlib import Path
from typing import Any, Dict, List, Optional
import httpx
import ... | 856 | 30,899 |
OpenViking | benchmark/locomo/hermes/eval.py | .py | """
Shared Hermes LoCoMo QA evaluator.
"""
from __future__ import annotations
import argparse
import asyncio
import csv
import json
import os
import sys
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
from pathlib import Path
from threading import Lock
import... | 829 | 28,901 |
OpenViking | benchmark/locomo/hermes/import_to_native.py | .py | """
Hermes built-in memory ingest tool.
Sends LoCoMo conversation transcripts to the Hermes API server.
The server persists them into `~/.hermes/state.db` so they can be
retrieved later through Hermes native memory tools.
"""
from __future__ import annotations
import argparse
import asyncio
import csv
import json
im... | 377 | 12,646 |
OpenViking | benchmark/locomo/openclaw/stat_judge_result.py | .py | import argparse
import csv
import os
def main():
parser = argparse.ArgumentParser(description="Statistics for judge result csv")
parser.add_argument(
"--input",
default="./result/qa_results_sample0.csv",
help="Path to judge result csv file, default: ./result/qa_results_sample0.csv",
... | 197 | 7,230 |
OpenViking | benchmark/locomo/openclaw/judge.py | .py | import argparse
import csv
import json
import os
import asyncio
from openai import AsyncOpenAI
from dotenv import load_dotenv
from pathlib import Path
# 加载本地环境变量文件
env_file = Path.home() / ".openviking_benchmark_env"
load_dotenv(env_file)
async def grade_answer(
llm_client, model: str, question: str, gold_answer... | 204 | 8,048 |
OpenViking | benchmark/locomo/openclaw/import_to_ov.py | .py | """
OpenViking data import tool.
Import conversations from LoCoMo JSON or plain text files into OpenViking memory.
Usage:
# Import LoCoMo JSON conversations
uv run python import_to_ov.py locomo10.json --sample 0 --sessions 1-4
# Import plain text conversations
uv run python import_to_ov.py example.tx... | 671 | 23,713 |
OpenViking | benchmark/locomo/openclaw/eval.py | .py | """
OpenClaw response evaluator.
Two modes:
ingest - Load conversations into openclaw (builds memory)
qa - Run QA questions against openclaw and output response vs expected answer
Usage:
# Ingest conversations
uv run python eval.py ingest locomo10.json --sample 0 --sessions 1-4
# Run QA evaluat... | 1,398 | 48,746 |
OpenViking | benchmark/locomo/claudecode/stat_judge_result.py | .py | """
Statistics for Claude Code LoCoMo QA judge results.
Reports accuracy by category, token/cost/latency for both ingest and QA phases.
Usage:
python stat_judge_result.py --input ./result/qa_results.csv
python stat_judge_result.py --input ./result/qa_results.csv --ingest-csv ./result/ingest_success.csv
"""
i... | 266 | 9,925 |
OpenViking | benchmark/locomo/claudecode/ingest_e2e.py | .py | """
End-to-end LoCoMo ingest via Claude Code chat (stream-json multi-turn).
One `claude -p` subprocess per LoCoMo session. All speaker turns are streamed
through stdin one at a time. Stdin close at end triggers SessionEnd hook
(plugin's session-end.mjs commits once). Plugin's Stop hook fires per-turn
and auto-capture ... | 511 | 18,418 |
OpenViking | benchmark/locomo/claudecode/ingest.py | .py | """
Ingest LoCoMo conversations into Claude Code's auto-memory system.
Same flow as openclaw: for each sample, send each session's bundled conversation
to Claude Code via `claude -p`, letting its auto-memory system extract and persist
memories. Each session is a separate `claude -p` invocation (independent conversatio... | 550 | 18,179 |
OpenViking | benchmark/locomo/claudecode/judge.py | .py | """
LLM judge for Claude Code LoCoMo QA results.
Reuses the same grading logic as openclaw/vikingbot benchmarks.
Usage:
python judge.py --input ./result/qa_results.csv
python judge.py --input ./result/qa_results.csv --parallel 20
"""
import argparse
import asyncio
import csv
import json
import os
import sys
... | 187 | 6,980 |
OpenViking | benchmark/locomo/claudecode/eval.py | .py | """
Run LoCoMo QA evaluation against Claude Code.
Each question is sent to `claude -p` in the corresponding sample's isolated
project directory. Claude Code's auto-memory loads MEMORY.md from that
project's memory directory, and it can Read individual session files.
Usage:
python eval.py --input ../data/locomo10.... | 674 | 21,594 |
OpenViking | benchmark/locomo/mem0/delete_user.py | .py | """
Delete all memories for one or more mem0 users.
Usage:
# Delete a single user
python delete_user.py conv-26
# Delete multiple users
python delete_user.py conv-26 conv-31 conv-45
# Delete first N users from locomo10.json
python delete_user.py --from-data --limit 2
# Delete all users f... | 85 | 2,743 |
OpenViking | benchmark/locomo/mem0/ingest.py | .py | """
Ingest LoCoMo conversations into mem0.
Each sample gets an isolated mem0 namespace keyed by sample_id (e.g. "conv-26").
speaker_a → "user" role, speaker_b → "assistant" role (following memorybench convention).
Usage:
# Ingest all samples
python ingest.py
# Ingest a specific sample
python ingest.p... | 454 | 15,079 |
OpenViking | benchmark/locomo/mem0/eval.py | .py | """
Evaluate LoCoMo QA via mem0 + OpenClaw (agent mode).
Questions are sent to an OpenClaw agent which calls mem0 internally.
Before each request, ~/.openclaw/openclaw.json is updated so that the
openclaw-mem0 plugin uses userId = sample_id, giving each conversation
sample its own isolated memory namespace.
Prerequis... | 843 | 31,738 |
OpenViking | benchmark/locomo/openviking/stat_judge_result.py | .py | import argparse
import csv
import json
import os
import sys
from collections import defaultdict
CATEGORY_NAMES = {
"1": "multi-hop",
"2": "temporal",
"3": "open-domain",
"4": "single-hop",
"5": "adversarial",
}
csv.field_size_limit(sys.maxsize)
def category_label(category: str) -> str:
categ... | 260 | 10,635 |
OpenViking | benchmark/locomo/openviking/locomo_prompts.py | .py | """
LoCoMo answer-generation prompt aligned with the mem0 benchmark runner.
"""
from datetime import datetime as _datetime
CATEGORY_NAMES = {
1: "multi-hop",
2: "temporal",
3: "open-domain",
4: "single-hop",
5: "adversarial",
}
CATEGORIES_TO_EVALUATE = [1, 2, 3, 4]
ANSWER_GENERATION_PROMPT = ""... | 289 | 17,730 |
OpenViking | benchmark/locomo/openviking/judge.py | .py | import argparse
import asyncio
import csv
import json
import os
import sys
from pathlib import Path
from dotenv import load_dotenv
from openai import AsyncAzureOpenAI, AsyncOpenAI
try:
from benchmark.locomo.openviking.locomo_prompts import (
JUDGE_SYSTEM_PROMPT,
get_judge_prompt,
get_judge... | 314 | 9,710 |
OpenViking | benchmark/locomo/openviking/import_to_ov.py | .py | """
OpenViking data import tool.
Import conversations from LoCoMo JSON or plain text files into OpenViking memory.
Usage:
# Import LoCoMo JSON conversations
uv run python import_to_ov.py locomo10.json --sample 0 --sessions 1-4
# Import plain text conversations
uv run python import_to_ov.py example.tx... | 827 | 28,969 |
OpenViking | benchmark/locomo/openviking/run_eval.py | .py | import argparse
import csv
import json
import os
import threading
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
from pathlib import Path
from typing import Any
from openviking_cli.client.sync_http import SyncHTTPClient
try:
from benchmark.locomo.openviki... | 981 | 35,041 |
OpenViking | benchmark/locomo/supermemory/ingest.py | .py | """
Ingest LoCoMo conversations into Supermemory.
Each sample gets an isolated Supermemory namespace keyed by containerTag = sample_id
(e.g. "conv-26"). Sessions are formatted as date-prefixed JSON content strings,
matching the memorybench supermemory provider convention.
Usage:
# Ingest all samples
python in... | 535 | 17,954 |
OpenViking | benchmark/locomo/supermemory/delete_container.py | .py | """
Delete all Supermemory documents for one or more containerTags (sample_ids).
Usage:
# Delete a single container
python delete_container.py conv-26
# Delete multiple containers
python delete_container.py conv-26 conv-31 conv-45
# Delete first N samples from locomo10.json
python delete_cont... | 189 | 6,322 |
OpenViking | benchmark/locomo/supermemory/eval.py | .py | """
Evaluate LoCoMo QA via Supermemory + OpenClaw (agent mode).
Questions are sent to an OpenClaw agent which calls Supermemory internally.
Before each sample, eval.py automatically:
1. Updates ~/.openclaw/openclaw.json to set openclaw-supermemory.config.containerTag = sample_id
(and switches plugins.slots.memo... | 803 | 30,326 |
OpenViking | benchmark/locomo/vikingbot/stat_judge_result.py | .py | import argparse
import csv
import json
import os
def make_table(title: str, rows: list[tuple[str, str]]) -> list[str]:
metric_width = max(len("Metric"), *(len(metric) for metric, _ in rows))
value_width = max(len("Value"), *(len(value) for _, value in rows))
border = f"+-{'-' * (metric_width + 2)}-+-{'-' ... | 186 | 7,080 |
OpenViking | benchmark/locomo/vikingbot/preflight_eval_config.py | .py | #!/usr/bin/env python3
import json
import os
import sys
from pathlib import Path
from openviking_cli.utils.config.config_loader import resolve_config_path
from openviking_cli.utils.config.consts import (
DEFAULT_OV_CONF,
OPENVIKING_CONFIG_ENV,
)
_USE_COLOR = (
hasattr(sys.stdout, "isatty")
and sys.st... | 115 | 3,460 |
OpenViking | benchmark/locomo/vikingbot/judge.py | .py | import argparse
import asyncio
import csv
import json
import os
import sys
import time
from pathlib import Path
from dotenv import load_dotenv
from openai import AsyncOpenAI
from progress_utils import (
AsyncProgressTracker,
format_duration,
make_three_state_progress,
should_show_progress,
)
# 加载本地环境变... | 234 | 8,980 |
OpenViking | benchmark/locomo/vikingbot/import_to_ov.py | .py | """
OpenViking data import tool.
Import conversations from LoCoMo JSON or plain text files into OpenViking memory.
Usage:
# Import LoCoMo JSON conversations
uv run python import_to_ov.py locomo10.json --sample 0 --sessions 1-4
# Import plain text conversations
uv run python import_to_ov.py example.tx... | 1,462 | 55,831 |
OpenViking | benchmark/locomo/vikingbot/progress_utils.py | .py | """Shared progress bar utilities for LoCoMo benchmark scripts.
Provides a four-state progress bar (successful / failed / running / pending) built on
top of ``rich.progress``, plus helpers for both threaded and asyncio
scenarios.
"""
from __future__ import annotations
import sys
import time
from typing import Optiona... | 298 | 9,653 |
OpenViking | benchmark/locomo/vikingbot/run_eval.py | .py | import argparse
import contextlib
import csv
import json
import os
import re
import subprocess
import sys
import threading
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
from pathlib import Path
from progress_utils import (
ThreadSafeProgressTracker,
m... | 720 | 26,828 |
OpenViking | benchmark/locomo/vikingbot/preflight_eval_runtime.py | .py | #!/usr/bin/env python3
import argparse
import getpass
import json
import os
import shlex
import sys
import urllib.error
import urllib.parse
import urllib.request
from pathlib import Path
from openviking_cli.utils.config.config_loader import resolve_config_path
from openviking_cli.utils.config.consts import (
DEFA... | 575 | 18,984 |
OpenViking | benchmark/longmemeval/openviking/stat_judge_result.py | .py | import argparse
import csv
import json
import os
import sys
from collections import defaultdict
csv.field_size_limit(sys.maxsize)
def main():
parser = argparse.ArgumentParser(description="Statistics for LongMemEval judge result csv")
parser.add_argument(
"--input",
default="./result/longmemev... | 131 | 5,171 |
OpenViking | benchmark/longmemeval/openviking/judge.py | .py | import argparse
import asyncio
import csv
import json
import os
import sys
from pathlib import Path
from dotenv import load_dotenv
from openai import AsyncAzureOpenAI, AsyncOpenAI
try:
from benchmark.longmemeval.openviking.longmemeval_prompts import (
get_judge_prompt,
get_strict_judge_prompt,
... | 245 | 7,605 |
OpenViking | benchmark/longmemeval/openviking/import_to_ov.py | .py | """
OpenViking data import tool for LongMemEval.
Import haystack sessions from LongMemEval JSON into OpenViking memory.
"""
import argparse
import asyncio
import csv
import hashlib
import json
import sys
import time
import traceback
from datetime import datetime, timedelta
from pathlib import Path
from typing import ... | 713 | 24,440 |
OpenViking | benchmark/longmemeval/openviking/longmemeval_prompts.py | .py | from __future__ import annotations
from datetime import datetime as _datetime
from typing import Any
QUESTION_TYPES = [
"temporal-reasoning",
"multi-session",
"knowledge-update",
"single-session-user",
"single-session-assistant",
"single-session-preference",
]
ANSWER_GENERATION_PROMPT = """Y... | 386 | 25,423 |
OpenViking | benchmark/longmemeval/openviking/run_eval.py | .py | import argparse
import csv
import hashlib
import json
import sys
import threading
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
from pathlib import Path
from typing import Any
from openviking_cli.client.sync_http import SyncHTTPClient
try:
from benchmark... | 717 | 25,197 |
OpenViking | benchmark/tau2/train/rollout_executor_vikingbot.py | .py | #!/usr/bin/env python3
"""Tau2 RolloutExecutor implementation for batch policy training."""
from __future__ import annotations
import asyncio
import json
import posixpath
import re
import time
from collections.abc import Callable
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any... | 1,593 | 58,756 |
OpenViking | benchmark/tau2/train/case_loader.py | .py | #!/usr/bin/env python3
"""Tau2 task CaseLoader for OpenViking batch policy training."""
from __future__ import annotations
import json
import os
from collections.abc import AsyncIterator
from dataclasses import dataclass
from pathlib import Path
from typing import Any
from openviking.session.train import Case, Rubri... | 144 | 5,353 |
OpenViking | benchmark/tau2/train/_rollout_helpers.py | .py | #!/usr/bin/env python3
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Shared private helpers for the Tau2 vikingbot and native rollout executors.
These are intentionally underscore-prefixed: they remain an internal surface
between the two executor implementation... | 117 | 3,392 |
OpenViking | benchmark/tau2/train/rollout_executor.py | .py | #!/usr/bin/env python3
"""Switchable Tau2 RolloutExecutor implementations."""
from __future__ import annotations
from typing import Any, Literal
from benchmark.tau2.train._rollout_helpers import (
_as_tool_input,
_safe_float,
_stringify,
_tau2_evaluation,
_to_jsonable,
)
from benchmark.tau2.train... | 161 | 6,039 |
OpenViking | benchmark/tau2/train/rollout_executor_native.py | .py | #!/usr/bin/env python3
"""TAU-2 native RolloutExecutor implementation for batch policy training."""
from __future__ import annotations
import asyncio
import json
import time
from dataclasses import dataclass, field
from typing import Any
from benchmark.tau2.train._rollout_helpers import (
_as_tool_input,
_ca... | 944 | 38,253 |
OpenViking | benchmark/tau2/train/service_app.py | .py | #!/usr/bin/env python3
"""HTTP service exposing tau2 cases and rollout execution."""
# ruff: noqa: E402
from __future__ import annotations
import argparse
import asyncio
import logging
import os
import sys
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Any
import uvico... | 218 | 7,166 |
OpenViking | benchmark/tau2/llm/scripts/run_memory_v2_eval.py | .py | #!/usr/bin/env python3
from __future__ import annotations
import argparse
import hashlib
import importlib
import json
import shutil
import sys
import time
from copy import deepcopy
from pathlib import Path
from typing import Any
from tau2_common import assert_tau2_results_complete, normalize_litellm_env
AGENT_NAME =... | 1,177 | 48,208 |
OpenViking | benchmark/tau2/llm/scripts/build_fixed_first_user_fixture.py | .py | #!/usr/bin/env python3
"""Build a TAU-2 fixed-first-user fixture from a TAU-2 results.json file."""
from __future__ import annotations
import argparse
import hashlib
import json
import sys
from pathlib import Path
from typing import Any
def _add_tau2_to_path(repo: Path) -> None:
repo = repo.expanduser().resolve... | 144 | 4,570 |
OpenViking | benchmark/tau2/llm/scripts/run_eval.py | .py | #!/usr/bin/env python3
from __future__ import annotations
import argparse
import importlib.util
import json
import os
import subprocess
import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
from typing import Any
from tau2_common import (
assert_tau2_results_complete,... | 1,126 | 44,544 |
OpenViking | benchmark/tau2/llm/scripts/tau2_common.py | .py | from __future__ import annotations
import json
import os
import re
import shutil
import subprocess
from collections import Counter
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
import yaml
TAU2_DIR = Path(__file__).resolve().parents[1]
REPO_ROOT = TAU2_DIR.parents[2]
CONFIRM... | 324 | 12,029 |
OpenViking | benchmark/tau2/common/tau2_env/tau2_tool_provider.py | .py | #!/usr/bin/env python3
"""Tau2-bench tool provider that exposes environment tools in OpenAI schema."""
from __future__ import annotations
import json
import os
from typing import Any, Iterable
from .tau2_environment import Tau2BenchEnv
class Tau2BenchToolProvider:
"""Wrap Tau2BenchEnv tools into OpenAI tool sc... | 90 | 3,082 |
OpenViking | benchmark/tau2/common/tau2_env/tau2_environment.py | .py | #!/usr/bin/env python3
from __future__ import annotations
import importlib
import json
import os
import time
from collections.abc import Callable
from functools import wraps
from typing import Any
from uuid import uuid4
from openviking.utils.model_retry import is_retryable_rate_limit_error, rate_limit_retry_delay
fr... | 414 | 15,140 |
OpenViking | benchmark/tau2/vikingbot/scripts/provision_openviking_user.py | .py | #!/usr/bin/env python3
"""Provision a benchmark runtime user and write a VikingBot user-key config."""
from __future__ import annotations
import argparse
import json
import os
from pathlib import Path
from typing import Any
from urllib.error import HTTPError
from urllib.parse import quote
from urllib.request import R... | 217 | 6,526 |
OpenViking | benchmark/tau2/vikingbot/scripts/commit_trajectory_to_memory.py | .py | #!/usr/bin/env python3
"""Commit runner trajectories into OpenViking memory.
This script reads trajectory JSON files produced by vikingbot_tau2_runner.py
and commits a minimal conversation (user -> assistant) into OpenViking.
Usage:
python3 commit_trajectory_to_memory.py --input /path/to/result_dir
python3 commit... | 199 | 6,381 |
OpenViking | benchmark/tau2/vikingbot/scripts/vikingbot_tau2_runner.py | .py | #!/usr/bin/env python3
"""Run a single tau2-bench task with VikingBot AgentLoop + Tau2 tools.
Key points:
1) Tau2BenchEnv is initialized once and exposes tools via Tau2BenchToolProvider.call_tool().
2) VikingBot already has its own multi-iteration agent loop, so we call it once.
3) We register Tau2 tools into VikingBo... | 316 | 11,116 |
OpenViking | benchmark/RAG/run.py | .py | import os
import sys
import yaml
import importlib
from argparse import ArgumentParser
from pathlib import Path
sys.path.append(str(Path(__file__).parent))
from src.core.logger import setup_logging
# ==========================================
# 1. Environment Initialization
# =========================================... | 170 | 6,130 |
OpenViking | benchmark/RAG/scripts/sample_dataset.py | .py | #!/usr/bin/env python3
"""
Sample datasets to create subsets with configurable size.
Supports both full dataset and sampled subsets with seed-based reproducibility.
"""
import argparse
import json
import os
import random
import shutil
import sys
from pathlib import Path
from typing import Any, Dict, List, Optional, Tu... | 1,297 | 50,755 |
OpenViking | benchmark/RAG/scripts/download_dataset.py | .py | #!/usr/bin/env python3
"""
Download datasets from public sources.
Supports URL downloads from GitHub, S3, etc.
"""
import argparse
import hashlib
import shutil
import sys
from pathlib import Path
from typing import Dict, Optional
from urllib.parse import urlparse
import requests
from tqdm import tqdm
sys.path.append... | 350 | 11,928 |
OpenViking | benchmark/RAG/scripts/run_sampling.py | .py | #!/usr/bin/env python3
"""Run sampling for all datasets with specific parameters."""
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent))
from sample_dataset import sample_dataset
def main():
input_dir = Path(__file__).parent.parent / "raw_data"
output_dir = Path(__file__).parent... | 96 | 2,382 |
OpenViking | benchmark/RAG/scripts/prepare_dataset.py | .py | #!/usr/bin/env python3
"""
Unified dataset preparation script.
Orchestrates download and sampling for end-to-end data preparation.
"""
import argparse
import sys
from pathlib import Path
from typing import List, Optional
sys.path.append(str(Path(__file__).parent))
from download_dataset import download_dataset, DATAS... | 255 | 7,612 |
OpenViking | benchmark/RAG/src/pipeline.py | .py | import os
import json
import time
import random
import re
from concurrent.futures import ThreadPoolExecutor, as_completed
from tqdm import tqdm
from pathlib import Path
import sys
sys.path.append(str(Path(__file__).parent))
from adapters.base import BaseAdapter
from core.logger import get_logger
from core.vector_stor... | 358 | 15,348 |
OpenViking | benchmark/RAG/src/core/monitor.py | .py | import threading
import time
from dataclasses import dataclass
@dataclass
class MonitorStats:
active_threads: int = 0
completed_tasks: int = 0
failed_tasks: int = 0
total_tokens: int = 0
start_time: float = 0.0
class BenchmarkMonitor:
def __init__(self):
self._lock = threading.Lock()... | 52 | 1,463 |
OpenViking | benchmark/RAG/src/core/logger.py | .py | import logging
import os
def setup_logging(log_file):
os.makedirs(os.path.dirname(log_file), exist_ok=True)
logger = logging.getLogger("Benchmark")
logger.setLevel(logging.INFO)
logger.handlers = []
formatter = logging.Formatter("%(asctime)s | %(levelname)-7s | %(message)s")
fh = logging.Fi... | 27 | 615 |
OpenViking | benchmark/RAG/src/core/llm_client.py | .py | import time
from langchain_openai import ChatOpenAI
from langchain_core.messages import HumanMessage
class LLMClientWrapper:
def __init__(self, config: dict, api_key: str):
self.llm = ChatOpenAI(
model=config['model'],
temperature=config['temperature'],
api_key=api_key,... | 31 | 1,048 |
OpenViking | benchmark/RAG/src/core/metrics.py | .py | import re
import string
import collections
from typing import List
class MetricsCalculator:
@staticmethod
def normalize_answer(s):
"""Normalize answer text: remove punctuation, convert to lowercase, remove articles"""
s = str(s).replace(',', "")
def remove_articles(text): return re.su... | 87 | 4,111 |
OpenViking | benchmark/RAG/src/core/vector_store.py | .py | import os
import sys
import time
from pathlib import Path
from typing import List
sys.path.append(str(Path(__file__).parent.parent))
import tiktoken
from adapters.base import StandardDoc
from openviking_sdk import SyncHTTPClient
class VikingStoreWrapper:
def __init__(self):
self.client = SyncHTTPClient(... | 103 | 4,057 |
OpenViking | benchmark/RAG/src/core/judge_util.py | .py | import json
import re
from langchain_core.messages import HumanMessage, SystemMessage
def llm_grader(
llm_client,
model: str,
question: str,
gold_answer: str or list,
response: str,
dataset_name: str = "Locomo"
) -> dict:
"""
Use an LLM as a judge to score a generated answer against a... | 165 | 7,198 |
OpenViking | benchmark/RAG/src/adapters/locomo_adapter.py | .py | # src/adapters/locomo_adapter.py
import json
import os
from typing import List, Dict, Any
from .base import BaseAdapter, StandardDoc, StandardSample, StandardQA
MISSING_RULE = "If no information is available to answer the question, write 'Not mentioned'."
CATEGORY_INSTRUCTIONS = {
"1": """Extract the exact fac... | 193 | 6,663 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.