npx skills add ...
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-openviking-embedding-switch
Switch OpenViking's embedding model to a local llama-server (or any OpenAI-compatible embedding endpoint) running inside a bwrap sandbox managed by job-env-manager. Handles the full lifecycle: detect current config, validate the target embedding endpoint, modify ov.conf, delete incompatible vectordb index when dimension changes, restart the openviking-server process in the sandbox, and verify the new collection dimension. Use this skill when the user wants to: (1) switch the OpenViking embedding model, (2) change the embedding dimension, (3) fix EmbeddingRebuildRequiredError after a dimension mismatch, (4) rebuild the vectordb index after an embedding model change, (5) use a local llama-server for OpenViking embeddings. Trigger words: "切换OpenViking embedding", "OpenViking embedding模型", "OpenViking向量化模型", "openviking embedding switch", "change openviking embedding model", "配置openviking embedding", "openviking llama embedding", "bge embedding openviking", "切换向量化模型", "OpenViking模型切换".
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-openviking-embedding-switch
Switch the embedding model used by OpenViking to a local llama-server or any OpenAI-compatible endpoint, with proper vectordb index rebuild and sandbox-safe restart.
⚠️ Single-purpose skill — all operations go through the job-env-manager REST API (
http://127.0.0.1:8090). Never runopenviking-serverdirectly on the host.
OpenViking is an AI context database that uses vector embeddings for semantic search. Its embedding model is configured in ov.conf under the embedding.dense section. When switching to a different embedding model (especially one with a different vector dimension), the existing vectordb index must be deleted and rebuilt — otherwise OpenViking raises EmbeddingRebuildRequiredError on startup.
Prerequisite check: job-env-manager running
http://127.0.0.1:8090running)127.0.0.1:{port} with --embeddings flagThis skill operates on local bwrap sandboxes via the job-env-manager REST API and does not access Huawei Cloud services — no Huawei Cloud IAM policies required. Equivalent access controls are listed in references/iam-policies.md.
Read ov.conf under the sandbox directory to get the current embedding.dense section (provider, model, dimension).
If unreachable, STOP. The script auto-corrects the dimension if the specified value doesn't match the actual endpoint output.
Backs up ov.conf to ov.conf.bak before modifying. Updates the embedding.dense section:
| Field | Description |
|---|---|
provider | Embedding provider name |
model | Model name (e.g., bge-small-zh-v1.5) |
api_key | API key for the endpoint (empty for local) |
api_base | Endpoint URL (e.g., http://127.0.0.1:18200/v1) |
dimension | Vector dimension (auto-corrected from endpoint) |
⚠️ Critical: If dimensions differ,
rm -rf vectordb/contextis required. OtherwiseEmbeddingRebuildRequiredErroron startup.
If dimension is unchanged, skip this step.
⚠️ Pitfall:
POST /envs/openviking/stop+startre-runsstart.sh, which overwritesov.confwith TokenHub credentials. Do not use stop/start.
Instead:
kill $PID, then poll for port 1933 release (up to 10s). If SIGTERM doesn't release the port, escalate to kill -9..openviking.pid and vectordb LOCK files.exec API with --max-time 15:GET /health every second until healthy=true or timeoutcollection_meta.json and confirms Dimension matches targetTraceback|ERROR.*Application startup failed|EmbeddingRebuildRequiredError|DataDirectoryLocked (avoids false positives from "Retrying" info messages)ov.conf.bak and exits with error| Parameter | Required | Description | Example |
|---|---|---|---|
MODEL_NAME | Yes | Embedding model name | bge-small-zh-v1.5 |
LLAMA_PORT | Yes | llama-server port | 18200 |
TARGET_DIMENSION | Yes | Vector dimension (auto-corrected if wrong) | 512 |
| Model | Dimension | Typical Use |
|---|---|---|
bge-small-zh-v1.5 | 512 | Lightweight Chinese embedding |
bge-large-zh-v1.5 | 1024 | High-quality Chinese embedding |
bge-small-en-v1.5 | 384 | Lightweight English embedding |
bge-base-en-v1.5 | 768 | General-purpose English embedding |
Qwen3-Embedding-0.6B | 1024 | Qwen3 embedding (TokenHub default) |
See references/verification-method.md for step-by-step checks and end-to-end acceptance criteria.
Quick verification:
See references/guardrails.md for the full rules. Key principles:
openviking-server directly on the hoststart.sh overwrites ov.conf with TokenHub credentialsov.conf.bak is restored if verification fails| Document | Description |
|---|---|
| config-reference.md | ov.conf embedding section field reference |
| guardrails.md | Safety rules: sandbox execution, restart sequence, rollback |
| iam-policies.md | Equivalent access controls (no Huawei Cloud IAM needed) |
| verification-method.md | Step-by-step verification for each workflow |
| related-commands.md | Common job-env-manager and curl commands |
| acceptance-criteria.md | Acceptance criteria for a successful switch |
| troubleshooting.md | Troubleshooting for common failure scenarios |
| dataflow-diagram.md | Mermaid data flow diagram |
| demo/example-input.json | Example input for the switch workflow |
┌─────────────────────────────────────────────────────┐
│ Host │
│ │
│ ┌─────────────┐ REST API ┌──────────────────┐ │
│ │ Agent │─────────────▶│ job-env-manager │ │
│ │ (this skill)│ │ :8090 │ │
│ └─────────────┘ └────────┬─────────┘ │
│ │ │
│ ┌──────────────────────────────┼──────┐ │
│ │ bwrap sandbox (openviking) │ │ │
│ │ ▼ │ │
│ │ ┌────────────────────────────────┐ │ │
│ │ │ openviking-server :1933 │ │ │
│ │ │ ├── ov.conf (embedding config)│ │ │
│ │ │ ├── vectordb/context/ │ │ │
│ │ │ └── viking/ (metadata) │ │ │
│ │ └────────────────────────────────┘ │ │
│ └──────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────┐ │
│ │ bwrap sandbox (llama) │ │
│ │ ┌────────────────────────────────┐ │ │
│ │ │ llama-server :18200 │ │ │
│ │ │ --embeddings --model bge-... │ │ │
│ │ └────────────────────────────────┘ │ │
│ └──────────────────────────────────────┘ │
│ │
│ Both sandboxes use --share-net, so 127.0.0.1 │
│ endpoints are mutually reachable. │
└─────────────────────────────────────────────────────┘