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
benchmark/RAG/src/adapters/financebench_adapter.py
.py
# src/adapters/finance_bench_adapter.py """ FinanceBench Dataset Adapter FinanceBench is a financial domain QA dataset with SEC financial report PDFs as documents. Data format: JSONL, each line contains question, answer, doc_name, evidence, etc. evidence_text in evidence is used for recall calculation. """ import jso...
167
5,888
OpenViking
benchmark/RAG/src/adapters/qasper_adapter.py
.py
# src/adapters/qasper_adapter.py """ Qasper Dataset Adapter Qasper is an academic paper QA dataset containing 1585 NLP papers and 5049 questions. Each question is answered by multiple annotators, with answer types including: - extractive_spans: text spans extracted from the paper - free_form_answer: free-form answers ...
418
15,603
OpenViking
benchmark/RAG/src/adapters/syllabusqa_adapter.py
.py
# src/adapters/syllabusqa_adapter.py """ SyllabusQA Dataset Adapter SyllabusQA is a syllabus QA dataset containing 39 syllabi and 5078 questions. Each question is about a specific syllabus, with answer types including: - single factual: single factual question - multi factual: multi factual question - single reasoning...
486
18,345
OpenViking
benchmark/RAG/src/adapters/base.py
.py
from abc import ABC, abstractmethod from dataclasses import dataclass, field from typing import List, Dict, Any, Union, Optional import sys from pathlib import Path sys.path.append(str(Path(__file__).parent.parent)) from core.logger import get_logger @dataclass class StandardQA: """Standardized single question-...
80
2,378
OpenViking
benchmark/cuvs/run_service_concurrency_benchmark.py
.py
#!/usr/bin/env python3 """Benchmark OpenViking's async vector-service facade under concurrency. This is the pre-embedding service layer: requests go through VikingVectorIndexBackend and its asyncio.to_thread adapter, but use precomputed query vectors so embedding and HTTP do not obscure vector-search scheduling. """ ...
643
22,814
OpenViking
benchmark/cuvs/summarize_service_runs.py
.py
#!/usr/bin/env python3 """Aggregate independent async vector-service benchmark processes.""" from __future__ import annotations import argparse import json import sys from collections import defaultdict from pathlib import Path from typing import Any, Sequence BENCHMARK_DIR = Path(__file__).resolve().parent if str(B...
248
9,718
OpenViking
benchmark/cuvs/summarize_index_runs.py
.py
#!/usr/bin/env python3 """Aggregate independent cuVS index benchmark processes. The index harness reports within-process latency distributions. This helper combines several result files without treating their raw batches as one run, so process-level medians and median absolute deviations remain visible. """ from __fu...
267
9,758
OpenViking
benchmark/cuvs/run_index_benchmark.py
.py
#!/usr/bin/env python3 """Benchmark OpenViking native flat search against cuVS indexes. This is an index-level benchmark: it deliberately excludes embedding, HTTP, record lookup, and LLM work. Datasets are generated as NumPy memory maps so a large run does not need a second full host-memory copy. """ from __future__ ...
1,074
41,462
OpenViking
benchmark/cuvs/run_collection_benchmark.py
.py
#!/usr/bin/env python3 """Benchmark OpenViking collection-level native and cuVS vector search. Unlike the index microbenchmark, this harness goes through CollectionAdapter and therefore includes filter compilation, label mapping, record lookup, and result normalization. It also measures the lazy rebuild paid by the fi...
761
27,076
OpenViking
benchmark/cuvs/summarize_collection_runs.py
.py
#!/usr/bin/env python3 """Aggregate independent OpenViking collection benchmark processes.""" from __future__ import annotations import argparse import json import sys from collections import defaultdict from pathlib import Path from typing import Any, Sequence BENCHMARK_DIR = Path(__file__).resolve().parent if str(...
315
12,234
OpenViking
benchmark/custom/session_contention_benchmark.py
.py
#!/usr/bin/env python3 """OpenViking server mixed-load benchmark.""" from __future__ import annotations import argparse import asyncio import csv import json import math import os import random import shutil import sys import time from dataclasses import asdict, dataclass, field from datetime import UTC, datetime fro...
1,954
71,824
OpenViking
benchmark/skillsbench/skill_bench_eval.py
.py
""" SkillsBench OpenClaw Evaluator. Evaluates OpenClaw's ability to use skills by running tasks from SkillsBench. Usage: # Prepare benchmark data (clone and filter tasks) uv run skill_bench_eval.py prepare # List available tasks uv run skill_bench_eval.py list # Run all tasks uv run skill_be...
936
35,427
OpenViking
benchmark/vectordb_perf/run.py
.py
#!/usr/bin/env python3 # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """OpenViking vector backend performance benchmark. This benchmark targets OpenViking's VikingVectorIndexBackend boundary. It uses the real OV context schema, URI scope filters, tenant context, a...
2,059
73,386
OpenViking
benchmark/vectordb_perf/async_utils.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Dependency-light async helpers for the VectorDB benchmark.""" from __future__ import annotations import asyncio from collections.abc import AsyncIterator, Awaitable, Callable, Iterable from typing import TypeVar ...
39
1,094
OpenViking
benchmark/retrieval/grep/vikingdb_bm25/effectiveness/step1_add_resource.py
.py
#!/usr/bin/env python3 """Import real code repos through the Python HTTP SDK with indexing enabled.""" from __future__ import annotations import argparse import os import time from openviking_sdk import OpenVikingError, SyncHTTPClient DEFAULT_SOURCE = os.path.expanduser("~/.openviking/data/benchmark/OpenViking-main...
77
2,229
OpenViking
benchmark/retrieval/grep/vikingdb_bm25/effectiveness/step2_quality.py
.py
#!/usr/bin/env python3 """Step 2 (Effectiveness): Evaluate retrieval quality for real code repos. Compares grep results (current engine) against ground truth from fs-engine grep. Computes Recall, Precision, F1 per query pattern. Ground truth is obtained by running grep with engine=fs (must be configured in ov.conf on...
314
11,222
OpenViking
benchmark/retrieval/grep/vikingdb_bm25/performance/step3_benchmark.py
.py
#!/usr/bin/env python3 """Step 3 (Performance): Benchmark grep latency and match count. Runs grep queries against the synthetic dataset, measuring latency and returned match count with a fixed node_limit. Run twice with different ov.conf engine settings to compare: 1. Set ov.conf: "grep": {"engine": "fs"}, restart,...
283
9,407
OpenViking
benchmark/retrieval/grep/vikingdb_bm25/performance/step2_reindex.py
.py
#!/usr/bin/env python3 """Step 2 (Performance): Optionally rebuild vector indexes for imported data. Submits async reindex tasks for each first-level subdirectory via SyncHTTPClient.reindex(wait=False), with a concurrency limit of 2 running tasks. When a task completes, the next one is submitted. This avoids tree-loc...
232
7,906
OpenViking
benchmark/retrieval/grep/vikingdb_bm25/performance/step0_prepare_data.py
.py
#!/usr/bin/env python3 """Step 0 (Performance): Prepare synthetic benchmark data for grep testing. Reads a source text file (ai_wiki.txt), replicates it across configurable directories and files, and injects target words at specified probabilities for retrieval testing. Directory layout: <output>/dir_000/wiki_000.t...
223
7,563
OpenViking
benchmark/retrieval/grep/vikingdb_bm25/performance/step1_add_resource.py
.py
#!/usr/bin/env python3 """Import synthetic data through the Python HTTP SDK without VLM processing.""" from __future__ import annotations import argparse import os import time from openviking_sdk import OpenVikingError, SyncHTTPClient DEFAULT_SOURCE = os.path.expanduser("~/.openviking/data/benchmark/synthetic") PRO...
173
5,839
OpenViking
examples/quick_start.py
.py
"""Quick start for the OpenViking Python HTTP SDK. Run these commands first: openviking-server init openviking-server Then, in another terminal: python examples/quick_start.py """ from openviking_sdk import SyncHTTPClient client = SyncHTTPClient(url="http://localhost:1933") try: client.initialize...
48
1,444
OpenViking
examples/cuvs_smoke.py
.py
"""Minimal GPU smoke test for OpenViking's cuVS dense-search backend.""" import argparse from concurrent.futures import ThreadPoolExecutor from openviking.storage.vectordb.collection.local_collection import ( get_or_create_local_collection, ) def main(algorithm: str, dtype: str) -> None: collection = get_or...
154
4,816
OpenViking
examples/watch_resource_example.py
.py
#!/usr/bin/env python3 # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: Apache-2.0 """ Resource Watch Feature Example This example demonstrates how to use the resource watch feature in OpenViking. The watch feature allows you to automatically re-process resources at specified...
150
4,058
OpenViking
examples/basic-usage/basic_usage.py
.py
#!/usr/bin/env python3 """ OpenViking Basic Usage Example This script demonstrates the core features of OpenViking: 1. HTTP client initialization 2. Adding resources (URLs, files, directories) 3. Browsing the virtual filesystem 4. Semantic search and retrieval 5. Tiered context loading (L0/L1/L2) 6. Session management...
306
9,567
OpenViking
examples/multi_tenant/shared_session_peer_id_http.py
.py
#!/usr/bin/env python3 """ HTTP demo for shared-session + peer_id semantics. This script creates one account, creates one regular USER, then runs two scenarios: 1. `multi-user` Uses an ADMIN key to switch effective user context within one account, and demonstrates that ADMIN may explicitly pass peer_id. 2. `no...
464
12,566
OpenViking
examples/multi_tenant/admin_workflow.py
.py
#!/usr/bin/env python3 """ Multi-Tenant Admin Workflow Example (Python SDK) Demonstrates account and user management via the Admin API: 1. Create account with first admin user 2. Register regular users 3. List accounts and users 4. Change user roles 5. Regenerate user keys 6. Use user key to access data ...
359
12,700
OpenViking
examples/snapshot/snapshot_cli_test.py
.py
from __future__ import annotations import json import os import subprocess import time import uuid from pathlib import Path from typing import Any OVCLI_CONFIG_FILE = "/home/byteide/.openviking/ovcli.conf" CLI_BIN = "ov" WORKSPACE_URI = "viking://resources/snapshot_cli_demo" COMMAND_TIMEOUT = 180 def unique_run_uri...
253
8,763
OpenViking
examples/snapshot/snapshot_http_api_test.py
.py
from __future__ import annotations import pprint import time import uuid from pathlib import Path from typing import Any import httpx from openviking_cli.utils.config.ovcli_config import load_ovcli_config OVCLI_CONFIG_FILE = "/home/byteide/.openviking/ovcli.conf" WORKSPACE_URI = "viking://resources/snapshot_http_de...
278
10,355
OpenViking
examples/snapshot/snapshot_example.py
.py
from __future__ import annotations import time import uuid from typing import Any OPENVIKING_URL = "http://127.0.0.1:1933" WORKSPACE_URI = "viking://resources/snapshot_sdk_demo" WAIT_TIMEOUT = 180.0 def unique_run_uri() -> tuple[str, str]: run_id = f"{int(time.time())}_{uuid.uuid4().hex[:8]}" return run_id,...
226
8,852
OpenViking
examples/openwebui-plugin/tests/test_tools.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Tests for the OpenWebUI tool server. Each test mocks the OpenViking HTTP layer with respx and asserts that the matching tool route forwards the right method, path, body, and tenant headers, and returns a payload mat...
196
6,894
OpenViking
examples/openwebui-plugin/openviking_openwebui/server.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """FastAPI app exposing OpenViking endpoints as OpenWebUI tools.""" from __future__ import annotations from contextlib import asynccontextmanager from typing import Optional from fastapi import FastAPI from .client ...
50
1,365
OpenViking
examples/openwebui-plugin/openviking_openwebui/__main__.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """``python -m openviking_openwebui`` entry point.""" from __future__ import annotations import uvicorn from .config import load_settings def main() -> None: settings = load_settings() uvicorn.run( ...
24
493
OpenViking
examples/openwebui-plugin/openviking_openwebui/__init__.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """OpenViking OpenWebUI tool server package.""" from .config import Settings, load_settings from .server import create_app __all__ = ["Settings", "create_app", "load_settings"]
9
280
OpenViking
examples/openwebui-plugin/openviking_openwebui/client.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Thin async HTTP client around the OpenViking server.""" from __future__ import annotations from typing import Any, Dict, Optional import httpx from .config import Settings class OVError(Exception): """Raise...
78
2,488
OpenViking
examples/openwebui-plugin/openviking_openwebui/config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Environment-driven configuration for the OpenWebUI tool server.""" from __future__ import annotations import os from dataclasses import dataclass def _env(name: str, default: str = "") -> str: value = os.envi...
64
1,693
OpenViking
examples/openwebui-plugin/openviking_openwebui/tools.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """FastAPI route handlers, one per OpenWebUI tool.""" from __future__ import annotations from typing import Any, Dict, List, Literal, Optional from fastapi import APIRouter, Depends, HTTPException, Request from pydan...
296
9,055
OpenViking
examples/openclaw-plugin/health_check_tools/ov-healthcheck.py
.py
#!/usr/bin/env python3 from __future__ import annotations import argparse import json import os import ssl import sys import time import urllib.error import urllib.parse import urllib.request import uuid from dataclasses import dataclass from pathlib import Path from typing import Any DEFAULT_GATEWAY_URL = "http://12...
1,648
59,443
OpenViking
examples/openclaw-plugin/tests/demo-memory-xiaomei.py
.py
#!/usr/bin/env python3 """ OpenClaw Plugin 演示脚本 — 用户: 小美(日常生活记录) 通过 OpenClaw Gateway 的 Responses API (/v1/responses) 进行多轮对话, 验证 OpenViking 记忆插件的端到端能力。消息经过完整 agent 流水线, 插件的 before_prompt_build(记忆注入)和 afterTurn(记忆抽取)自动触发。 前提: OpenClaw 配置中需开启 Responses API。在 openclaw.config.json 的 gateways 中添加: { "type": "ope...
259
12,106
OpenViking
examples/openclaw-plugin/tests/test-memory-chain.py
.py
#!/usr/bin/env python3 """ OpenClaw 记忆链路完整测试脚本 验证 OpenViking 记忆插件重构后的端到端链路: 1. afterTurn: 本轮消息无损写入 OpenViking session,sessionId 一致 2. commit: 归档消息 + 提取长期记忆 + .meta.json 写入 3. assemble: 同用户继续对话时, 从 latest_archive_overview + active messages 重组上下文 4. assemble budget trimming: 小 token budget 下 latest_archive_overview 被裁剪 ...
935
38,252
OpenViking
examples/openclaw-plugin/tests/demo-memory-ajie.py
.py
#!/usr/bin/env python3 """ OpenClaw Plugin 演示脚本 — 用户: 阿杰(后端开发) 通过 OpenClaw Gateway 的 Responses API (/v1/responses) 进行多轮对话, 验证 OpenViking 记忆插件的端到端能力。消息经过完整 agent 流水线, 插件的 before_prompt_build(记忆注入)和 afterTurn(记忆抽取)自动触发。 前提: OpenClaw 配置中需开启 Responses API。在 openclaw.config.json 的 gateways 中添加: { "type": "openr...
259
11,859
OpenViking
examples/openclaw-plugin/tests/test-tool-capture.py
.py
#!/usr/bin/env python3 """ 测试 extractNewTurnTexts 改动:验证 toolUse/toolResult 内容是否被正确捕获到 OV session 中。 测试策略: 1. 发送一条消息,触发模型使用工具(如 native_tool / code_execution) 2. 等待 afterTurn 完成 3. 从 OV session 中读取已存储的消息 4. 断言存储的消息中包含 toolUse 和 toolResult 相关内容 用法: python test-tool-capture.py python test-tool-capture.py --verbos...
445
16,300
OpenViking
examples/openclaw-plugin/tests/e2e/test-cjk-token-estimation.py
.py
#!/usr/bin/env python3 """OpenClaw plugin E2E for CJK-aware token estimation. This test drives the real OpenClaw Gateway, then verifies the OpenViking plugin's own assemble diagnostics. It intentionally checks the plugin-side token estimate, not only the OV REST session counters. """ from __future__ import annotation...
271
9,124
OpenViking
examples/openclaw-plugin/tests/e2e/test-archive-expand.py
.py
#!/usr/bin/env python3 """ ov_archive_expand 归档展开端到端测试 — 用户: 小杰(后端开发新人) ================================================================================ 一、用例设计思路 ================================================================================ 核心验证点: 当对话累积到一定量后,早期内容会被压缩归档(archive),归档摘要只保留概要 信息,精确的参数值(IP、端口、命令、hash...
1,096
47,998
OpenViking
examples/openclaw-plugin/tests/e2e/test-memory-chain.py
.py
#!/usr/bin/env python3 """ OpenClaw 记忆链路完整端到端测试 ================================================================================ 一、用例设计思路 ================================================================================ 验证 OpenViking 记忆插件的完整链路,覆盖消息写入到记忆召回的每个环节: afterTurn → commit → assemble → sessionId 一致性 → 新用户记忆召...
1,249
50,773
OpenViking
examples/openclaw-plugin/tests/e2e/test-tool-capture.py
.py
#!/usr/bin/env python3 """ extractNewTurnTexts 工具调用捕获端到端测试 ================================================================================ 一、用例设计思路 ================================================================================ 核心验证点: 当模型在回复中调用工具(如 code_execution、native_tool 等)时,Gateway 的 extractNewTurnTexts 需要...
572
21,706
OpenViking
examples/openclaw-plugin/scripts/upload_tos.py
.py
#!/usr/bin/env python3 import argparse import datetime import hashlib import json import os import pathlib import re import tempfile from typing import NamedTuple import tos SCRIPT_DIR = pathlib.Path(__file__).resolve().parent DEFAULT_INSTALL_SH = SCRIPT_DIR / "install.sh" DEFAULT_TGZ = SCRIPT_DIR / "openviking.tgz"...
295
9,932
OpenViking
examples/openclaw-plugin/scripts/test_upload_tos.py
.py
#!/usr/bin/env python3 import importlib.util import pathlib import re SCRIPT_DIR = pathlib.Path(__file__).resolve().parent MODULE_PATH = SCRIPT_DIR / "upload_tos.py" def load_module(): spec = importlib.util.spec_from_file_location("upload_tos", MODULE_PATH) module = importlib.util.module_from_spec(spec) ...
226
7,982
OpenViking
examples/cloud/bob.py
.py
#!/usr/bin/env python3 """ Bob — 新入职成员的使用流程 操作:浏览团队资源 → 回顾团队记忆 → 添加自己的资源 → 对话 → 沉淀记忆 → 带上下文搜索 获取 API Key: API Key 由租户管理员分配,流程如下: 1. 管理员(如 Alice)用自己的 Key 注册 Bob: curl -X POST http://localhost:1933/api/v1/admin/accounts/demo-team/users \ -H "X-API-Key: <alice_key>" -H "Content-Type: applica...
190
7,697
OpenViking
examples/cloud/setup_users.py
.py
#!/usr/bin/env python3 """ 创建租户和用户,获取 API Key 前置条件: 1. 按照 GUIDE.md 完成云服务开通和配置 2. 启动 OpenViking Server: export OPENVIKING_CONFIG_FILE=examples/cloud/ov.conf openviking-server 获取用户 API Key 的流程: 1. 在 ov.conf 中设置 server.root_api_key(管理员密钥) 2. 用 root_api_key 调用 POST /api/v1/admin/accounts...
98
3,151
OpenViking
examples/cloud/alice.py
.py
#!/usr/bin/env python3 """ Alice — 技术负责人的使用流程 操作:添加项目文档 → 语义搜索 → 多轮对话 → 沉淀记忆 → 回顾记忆 获取 API Key: API Key 由管理员通过 Admin API 分配,流程如下: 1. ov.conf 中配置 server.root_api_key(如 "test") 2. 用 root_api_key 创建租户和管理员: curl -X POST http://localhost:1933/api/v1/admin/accounts \ -H "X-API-Key: test" -H...
172
6,749
OpenViking
examples/langchain-langgraph/langchain/message-history/quick_app.py
.py
"""Deterministic LangChain app using OpenViking-backed chat history.""" from __future__ import annotations from langchain_core.messages import AIMessage, BaseMessage, HumanMessage from langchain_core.runnables import RunnableLambda from langchain_core.runnables.history import RunnableWithMessageHistory from langchai...
53
1,619
OpenViking
examples/langchain-langgraph/langchain/rag/quick_app.py
.py
"""Deterministic LangChain RAG smoke app using OpenViking as retriever.""" from __future__ import annotations from langchain_core.language_models.fake_chat_models import FakeListChatModel from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langchain_cor...
65
1,992
OpenViking
examples/langchain-langgraph/langchain/context-backend/quick_app.py
.py
"""Deterministic LangChain app using OpenViking as a session context backend.""" from __future__ import annotations from langchain_core.messages import AIMessage, HumanMessage from langchain_core.runnables import RunnableLambda from langchain_openviking import ( InMemoryOpenVikingClient, OpenVikingCommitPoli...
53
1,441
OpenViking
examples/langchain-langgraph/langgraph/middleware/quick_app.py
.py
"""Deterministic LangGraph app using OpenViking context middleware.""" from typing import Any from langchain_core.messages import AIMessage, BaseMessage, HumanMessage from langgraph.graph import END, START, StateGraph from langgraph.graph.message import add_messages from typing_extensions import Annotated, TypedDict ...
94
2,949
OpenViking
examples/langchain-langgraph/langgraph/agent/quick_app.py
.py
"""Deterministic LangGraph smoke app using OpenViking tools and store.""" from langchain_core.language_models.fake_chat_models import FakeListChatModel from langchain_core.messages import AIMessage, HumanMessage from langgraph.graph import END, START, StateGraph from langgraph.graph.message import add_messages from ty...
92
2,882
OpenViking
examples/langchain-langgraph/langgraph/agent/live_app.py
.py
"""Live LangGraph app using OpenViking middleware and an OpenAI-compatible LLM. Required: ARK_API_KEY Optional: ARK_BASE_URL, ARK_MODEL OPENVIKING_URL, OPENVIKING_API_KEY, OPENVIKING_LIVE_COMMIT_TIMEOUT """ from __future__ import annotations import os import time import uuid from typing import Any from langc...
212
6,791
OpenViking
examples/skills/ov-add-paper/scripts/validate_ara.py
.py
#!/usr/bin/env python3 """Validate an ARA-style paper artifact before OpenViking ingestion.""" from __future__ import annotations import argparse import json import re import sys from pathlib import Path REQUIRED_FILES = [ "PAPER.md", "logic/problem.md", "logic/claims.md", "logic/concepts.md", "...
219
8,029
OpenViking
examples/skills/ov_dream/tests/test_dream_cli.py
.py
from __future__ import annotations import importlib.util import json import sys from pathlib import Path def _load_dream_module(): module_path = Path("examples/skills/ov_dream/scripts/dream.py").resolve() spec = importlib.util.spec_from_file_location("ov_dream_cli", module_path) assert spec is not None a...
313
10,841
OpenViking
examples/skills/ov_dream/scripts/dream.py
.py
from __future__ import annotations import argparse import json import os import sys from dataclasses import dataclass from datetime import datetime, timezone from pathlib import Path from typing import Any, Iterable from urllib.error import HTTPError from urllib.request import Request, urlopen DEFAULT_BASE_URL = "htt...
515
18,027
OpenViking
examples/common/recipe.py
.py
#!/usr/bin/env python3 """ RAG Pipeline - Retrieval-Augmented Generation using OpenViking + LLM Focused on querying and answer generation, not resource management """ import json import time from typing import Any, Dict, List, Optional import requests from openviking_sdk import SyncHTTPClient class Recipe: """ ...
252
8,723
OpenViking
examples/common/boring_logging_config.py
.py
""" Centralized logging configuration Set OV_DEBUG=1 environment variable to enable debug logging """ import logging import logging.config import os import warnings # Suppress warnings warnings.filterwarnings("ignore") # Check debug mode from environment DEBUG = os.environ.get("OV_DEBUG") == "1" if DEBUG: # Deb...
129
4,625
OpenViking
examples/common/resource_manager.py
.py
#!/usr/bin/env python3 """ Resource Manager - Shared utilities for adding resources to OpenViking """ from pathlib import Path from typing import Optional from openviking_sdk import SyncHTTPClient from rich.console import Console def create_client(server_url: str = "http://127.0.0.1:1933") -> SyncHTTPClient: ""...
100
2,870
OpenViking
openviking_cli/exceptions.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """ Unified exception classes for OpenViking. Based on gRPC standard status codes for consistency across service boundaries. """ from typing import Optional class OpenVikingError(Exception): """Base exception fo...
207
7,048
OpenViking
openviking_cli/setup_wizard.py
.py
"""openviking-server init - interactive setup wizard for OpenViking. Guides users through model selection and configuration, with a focus on local deployment via Ollama for macOS / Apple Silicon beginners. """ from __future__ import annotations import importlib import json import os import re import secrets import s...
2,057
75,982
OpenViking
openviking_cli/_sdk_import.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 from __future__ import annotations import sys from importlib import import_module from pathlib import Path def import_openviking_sdk(): sdk_root = Path(__file__).resolve().parents[1] / "sdk" / "python" if (sd...
25
877
OpenViking
openviking_cli/rust_cli.py
.py
"""ov 命令的极简 Python 包装器 设计原则: 1. 职责单一:仅负责查找二进制并 execv 2. 无网络依赖:不实现下载功能 3. 极简代码:尽可能减少启动开销 4. 快速失败:找不到立即提示用户 性能说明: - Python 虚拟机启动 + 导入基础模块:约 30-50ms - 一旦 execv 执行,后续为纯 Rust 二进制,零开销 Rust CLI 独立发布能力完全保留,用户可通过以下方式获取: - 官方安装脚本(零开销) - GitHub Releases 手动下载(零开销) - cargo install(零开销) - 包管理器(未来) """ import os import subprocess...
116
3,939
OpenViking
openviking_cli/doctor.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """openviking-server doctor - validate OpenViking subsystems and report actionable diagnostics. Unlike ``ov health`` (which pings a running server), ``openviking-server doctor`` checks local prerequisites without requi...
734
26,471
OpenViking
openviking_cli/server_bootstrap.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Lightweight entry point for openviking-server. This module lives outside the ``openviking`` package so that importing it does NOT trigger ``openviking/__init__.py`` (which eagerly imports clients and initialises the...
109
3,821
OpenViking
openviking_cli/client/sync_http.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Compatibility shim for the legacy sync HTTP client import path.""" from openviking_cli.client._http_compat import SyncHTTPClient __all__ = ["SyncHTTPClient"]
8
264
OpenViking
openviking_cli/client/_http_compat.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Compatibility bridge for legacy HTTP client entry points.""" from __future__ import annotations import json import os from pathlib import Path from typing import Any, Dict import httpx from openviking_cli._sdk_im...
338
12,469
OpenViking
openviking_cli/client/__init__.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """OpenViking HTTP client compatibility exports.""" from openviking_cli.client.http import AsyncHTTPClient from openviking_cli.client.sync_http import SyncHTTPClient __all__ = [ "AsyncHTTPClient", "SyncHTTPCli...
12
328
OpenViking
openviking_cli/client/http.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Compatibility shim for the legacy HTTP client import path.""" import httpx from openviking_cli.client._http_compat import ERROR_CODE_TO_EXCEPTION, AsyncHTTPClient __all__ = ["AsyncHTTPClient", "ERROR_CODE_TO_EXCEP...
10
336
OpenViking
openviking_cli/retrieve/types.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """ Data types for OpenViking retrieval module. """ import queue import time from dataclasses import dataclass, field from enum import Enum from typing import Any, Dict, List, Optional class ContextType(str, Enum): ...
445
13,780
OpenViking
openviking_cli/retrieve/__init__.py
.py
from openviking_cli.retrieve.types import ( ContextType, FindResult, MatchedContext, QueryPlan, QueryResult, RelatedContext, TypedQuery, ) __all__ = [ # Types "ContextType", "TypedQuery", "QueryPlan", "RelatedContext", "MatchedContext", "QueryResult", "FindRe...
21
329
OpenViking
openviking_cli/session/user_id.py
.py
from openviking.core.identifiers import ( normalize_identifier_part, validate_account_id, validate_identifier_part, validate_user_id, ) from openviking_cli.utils import get_logger logger = get_logger(__name__) __all__ = [ "UserIdentifier", "normalize_identifier_part", "validate_account_id"...
76
1,990
OpenViking
openviking_cli/utils/logger.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """ Logging utilities for OpenViking. """ import atexit import contextvars import logging import queue import sys import threading from contextlib import contextmanager from logging.handlers import QueueHandler, QueueL...
967
33,310
OpenViking
openviking_cli/utils/storage.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """ Storage path management for OpenViking. Manages file storage in .openviking/ directory for media files (images, tables, etc.). """ import shutil from pathlib import Path from typing import Optional from openvikin...
265
7,900
OpenViking
openviking_cli/utils/__init__.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Utility functions and helpers.""" from openviking_cli.utils.async_utils import run_async from openviking_cli.utils.llm import StructuredLLM, parse_json_from_response, parse_json_to_model from openviking_cli.utils.lo...
19
575
OpenViking
openviking_cli/utils/extractor.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Content extractor types for OpenViking.""" from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import Any, Dict, List, Optional, Tuple class ContentType(Enum): T...
75
1,803
OpenViking
openviking_cli/utils/async_utils.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """ Async helper utilities for running coroutines from sync code. """ import asyncio import atexit import threading from typing import Coroutine, TypeVar T = TypeVar("T") _lock = threading.Lock() _loop: asyncio.Abstr...
99
3,219
OpenViking
openviking_cli/utils/llm.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """ LLM utilities for OpenViking. Provides unified structured output handling with response_format support. """ import json import re from typing import Any, Dict, Optional, Type, TypeVar import json_repair from pyda...
235
6,548
OpenViking
openviking_cli/utils/ollama.py
.py
"""Shared Ollama utilities for OpenViking. Used by both the ``openviking-server init`` setup wizard and the ``openviking-server`` bootstrap to detect, start, and health-check a local Ollama instance. Design principle: **ensure running, never stop** — Ollama is a shared service that other tools may depend on. We star...
308
10,420
OpenViking
openviking_cli/utils/uri.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """ URI utilities for OpenViking. All context objects in OpenViking are identified by URIs in the format: viking://<scope>/<path> """ import re from typing import Dict, Optional class VikingURI: """ Viking U...
323
9,946
OpenViking
openviking_cli/utils/config/git_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Git version control configuration for OpenViking.""" from typing import Literal, Optional from pydantic import BaseModel, Field, model_validator class GitLocalConfig(BaseModel): """Configuration for the local ...
122
4,375
OpenViking
openviking_cli/utils/config/log_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 from typing import Any, Dict from pydantic import BaseModel, Field class LogConfig(BaseModel): """Logging configuration for OpenViking.""" model_config = {"extra": "forbid"} level: str = Field( ...
41
1,302
OpenViking
openviking_cli/utils/config/ovcli_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Configuration schema and loader for ovcli.conf.""" from pathlib import Path from typing import Any, Dict, Optional from pydantic import BaseModel, ValidationError, model_validator from .config_loader import resolv...
108
3,873
OpenViking
openviking_cli/utils/config/agfs_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 from __future__ import annotations from enum import Enum from typing import Any, List, Literal, Optional from urllib.parse import urlparse from pydantic import BaseModel, Field, model_validator from openviking_cli.ut...
592
23,073
OpenViking
openviking_cli/utils/config/encryption_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 from typing import Any, Dict, Optional from pydantic import BaseModel, Field class LocalEncryptionProviderConfig(BaseModel): """Local file encryption provider configuration. Uses a local file to store the Ro...
159
5,381
OpenViking
openviking_cli/utils/config/__init__.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 from . import embedding_config from .agfs_config import AGFSConfig from .config_loader import ( load_json_config, require_config, resolve_config_path, ) from .consts import ( DEFAULT_CONFIG_DIR, DEFA...
171
4,878
OpenViking
openviking_cli/utils/config/config_utils.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Shared helpers for config validation and error formatting.""" import difflib from typing import Any, Optional, get_args, get_origin from pydantic import BaseModel, ValidationError def suggest_closest_field(field_...
117
3,898
OpenViking
openviking_cli/utils/config/oauth_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """OAuth 2.1 configuration. All issued tokens (access, refresh, authorization code, OTP) are opaque random strings stored as SHA-256 hashes in ``{workspace}/oauth.db``. Access tokens carry an ``ovat_`` prefix used as a...
69
2,356
OpenViking
openviking_cli/utils/config/transaction_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 from pydantic import BaseModel, Field class TransactionConfig(BaseModel): """Deprecated compatibility settings for legacy transaction fields. Prefer ``storage.agfs.pathlock`` only for active expiry configurat...
39
1,230
OpenViking
openviking_cli/utils/config/open_viking_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 import json import logging import os from pathlib import Path from threading import Lock from typing import Any, Dict, List, Optional from pydantic import BaseModel, Field, ValidationError, model_validator from openvi...
720
27,053
OpenViking
openviking_cli/utils/config/queue_worker_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Queue worker runtime configuration.""" from pydantic import BaseModel, Field class QueueWorkerConfig(BaseModel): """Runtime limits for one queue worker.""" max_concurrent: int = Field( default=4, ...
30
858
OpenViking
openviking_cli/utils/config/consts.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Configuration constants for OpenViking.""" from pathlib import Path DEFAULT_CONFIG_DIR = Path.home() / ".openviking" SYSTEM_CONFIG_DIR = Path("/etc/openviking") # ==================================================...
94
3,826
OpenViking
openviking_cli/utils/config/embedding_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 from typing import Any, ClassVar, List, Literal, Optional, Tuple, cast from pydantic import BaseModel, Field, model_validator TEXT_SOURCE_CONTENT_ONLY = "content_only" TEXT_SOURCE_SUMMARY_FIRST = "summary_first" TEXT_...
1,109
47,030
OpenViking
openviking_cli/utils/config/prompts_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 from typing import Any, Dict from pydantic import BaseModel, Field class PromptsConfig(BaseModel): """Prompt template configuration for OpenViking.""" templates_dir: str = Field( default="", ...
29
846
OpenViking
openviking_cli/utils/config/memory_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 from typing import Any, Dict from pydantic import BaseModel, Field, field_validator, model_validator from openviking_cli.utils.logger import get_logger logger = get_logger(__name__) class SessionAutoCommitConfig(Ba...
127
4,808
OpenViking
openviking_cli/utils/config/config_loader.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 """Configuration file loading utilities. Provides a four-level resolution chain for locating config files: 1. Explicit path (constructor parameter / --config) 2. Environment variable 3. Default path (~/.openvikin...
127
3,702
OpenViking
openviking_cli/utils/config/vectordb_config.py
.py
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. # SPDX-License-Identifier: AGPL-3.0 from typing import Any, Dict, Literal, Optional from pydantic import BaseModel, Field, model_validator from openviking_cli.utils.logger import get_logger COLLECTION_NAME = "context" DEFAULT_PROJECT_NAME = "default" D...
329
11,721