huaweicloud/huaweicloud-skills

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.

Ver código-fonte
Documento original do Skill

Renderizado do repositório de origem, preservando títulos, exemplos, código, tabelas, links e imagens.

OpenViking Embedding Model 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 run openviking-server directly 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.

Architecture

OpenViking Embedding Model Switch
├── Detect current config     (Read ov.conf embedding.dense section)
├── Validate endpoint         (Check llama-server /v1/embeddings)
├── Modify ov.conf            (Update provider, model, api_base, dimension)
├── Delete vectordb index     (If dimension changed: rm -rf vectordb/context)
├── Restart server            (Kill + exec, NOT stop/start)
└── Verify                    (Health + PID + dimension + log check)
┌─────────────────────────────────────────────────────┐
│                    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.                   │
└─────────────────────────────────────────────────────┘

Prerequisites

Prerequisite check: job-env-manager running ``bash curl -s http://127.0.0.1:8090/api/v1/envs/openviking | python3 -c "import sys,json; print(json.load(sys.stdin)['state'])"
  • job-env-manager running on http://127.0.0.1:8090
  • OpenViking environment deployed and running (state = running)
  • llama-server running at 127.0.0.1:{port} with --embeddings flag
  • curl and python3 available on the host
  • No AK/SK or Huawei Cloud credentials required

IAM Permission Policies

This 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.

核心命令 (Core Workflow)

Task 1: Detect Current Configuration

bash
SANDBOX_DIR=$(curl -s http://127.0.0.1:8090/api/v1/envs/openviking \
  | python3 -c "import sys,json; print(json.load(sys.stdin)['cwd'])")

Read ov.conf under the sandbox directory to get the current embedding.dense section (provider, model, dimension).

Task 2: Validate Target Embedding Endpoint

bash
curl -s http://127.0.0.1:${LLAMA_PORT}/v1/embeddings \
  -H "Content-Type: application/json" \
  -d '{"model":"${MODEL_NAME}","input":"test"}' \
  | python3 -c "import sys,json; d=json.load(sys.stdin); print(len(d['data'][0]['embedding']))"

If unreachable, STOP. The script auto-corrects the dimension if the specified value doesn't match the actual endpoint output.

Task 3: Modify ov.conf

Backs up ov.conf to ov.conf.bak before modifying. Updates the embedding.dense section:

FieldDescription
providerEmbedding provider name
modelModel name (e.g., bge-small-zh-v1.5)
api_keyAPI key for the endpoint (empty for local)
api_baseEndpoint URL (e.g., http://127.0.0.1:18200/v1)
dimensionVector dimension (auto-corrected from endpoint)

Task 4: Delete Incompatible vectordb Index

⚠️ Critical: If dimensions differ, rm -rf vectordb/context is required. Otherwise EmbeddingRebuildRequiredError on startup.

If dimension is unchanged, skip this step.

Task 5: Restart openviking-server Inside the Sandbox

⚠️ Pitfall: POST /envs/openviking/stop + start re-runs start.sh, which overwrites ov.conf with TokenHub credentials. Do not use stop/start.

Instead:

  1. Kill old process from host: kill $PID, then poll for port 1933 release (up to 10s). If SIGTERM doesn't release the port, escalate to kill -9.
  2. Clean up stale lock files: .openviking.pid and vectordb LOCK files.
  3. Start new server via exec API with --max-time 15:
bash
curl -s --max-time 15 -X POST http://127.0.0.1:8090/api/v1/envs/openviking/exec \
  -H 'Content-Type: application/json' \
  -d '{"cmd":["bash","-c","nohup /root/runtime/openviking/venv/bin/openviking-server --config /workspace/process_dir/ov.conf > /workspace/process_dir/openviking-server.log 2>&1 & sleep 2 && echo started"]}'

Task 6: Verify

  1. Health check with retry loop (up to 30s): polls GET /health every second until healthy=true or timeout
  2. PID change check: verifies the new server PID differs from the old one (detects port conflict false positives)
  3. Collection dimension check: reads collection_meta.json and confirms Dimension matches target
  4. Log error check: precise grep for Traceback|ERROR.*Application startup failed|EmbeddingRebuildRequiredError|DataDirectoryLocked (avoids false positives from "Retrying" info messages)
  5. Rollback on failure: if health check fails or PID unchanged, restores ov.conf.bak and exits with error

Parameter Confirmation

ParameterRequiredDescriptionExample
MODEL_NAMEYesEmbedding model namebge-small-zh-v1.5
LLAMA_PORTYesllama-server port18200
TARGET_DIMENSIONYesVector dimension (auto-corrected if wrong)512
bash
# Usage
bash scripts/switch-embedding-model.sh <model_name> <llama_port> <dimension>

Common Embedding Model Dimensions

ModelDimensionTypical Use
bge-small-zh-v1.5512Lightweight Chinese embedding
bge-large-zh-v1.51024High-quality Chinese embedding
bge-small-en-v1.5384Lightweight English embedding
bge-base-en-v1.5768General-purpose English embedding
Qwen3-Embedding-0.6B1024Qwen3 embedding (TokenHub default)

Verification

See references/verification-method.md for step-by-step checks and end-to-end acceptance criteria.

Quick verification:

bash
# 1. Server healthy
curl -s http://127.0.0.1:1933/health \
  | python3 -c "import sys,json; assert json.load(sys.stdin)['healthy']; print('OK')"

# 2. Collection dimension matches target
python3 -c "import json; d=json.load(open('${SANDBOX_DIR}/data/vectordb/context/collection_meta.json')); assert d['Dimension']==${TARGET_DIMENSION}; print('OK')"

# 3. No errors in log (precise pattern)
grep -ci "Traceback\|Application startup failed\|EmbeddingRebuildRequiredError\|DataDirectoryLocked" \
  "${SANDBOX_DIR}/process_dir/openviking-server.log"
# Expected: 0

Guardrails

See references/guardrails.md for the full rules. Key principles:

  • Always run through job-env-manager — never execute openviking-server directly on the host
  • Never use stop/start restartstart.sh overwrites ov.conf with TokenHub credentials
  • Validate before modify — the target endpoint must respond before any config change
  • Rollback on failureov.conf.bak is restored if verification fails

References

DocumentDescription
config-reference.mdov.conf embedding section field reference
guardrails.mdSafety rules: sandbox execution, restart sequence, rollback
iam-policies.mdEquivalent access controls (no Huawei Cloud IAM needed)
verification-method.mdStep-by-step verification for each workflow
related-commands.mdCommon job-env-manager and curl commands
acceptance-criteria.mdAcceptance criteria for a successful switch
troubleshooting.mdTroubleshooting for common failure scenarios
dataflow-diagram.mdMermaid data flow diagram
demo/example-input.jsonExample input for the switch workflow
do mesmo repositório

Mais Skills

Todos os Skills
huaweicloud
Comunidade

huawei-cloud-publish-work-to-gallery

Publish user's work to the Huawei Cloud University Operations Platform (华为云高校运营平台/作品陈列馆). Use this skill whenever the user wants to publish, submit, or upload a project/work to the gallery or a training camp (训练营) on the platform — including casual phrasings like "把作品发布上去", "投稿到陈列馆", "传作品到平台", "提交作品/项目", "报名发布作品", as well as formal ones like "publish to work gallery", "submit to training camp", "upload work to the platform". Do NOT use for general dev questions, git push to GitCode alone, or platform browsing without publishing intent.

instalações
5
GitHub Stars
50
Atualizado
23 de set.
huaweicloud
Comunidade

huawei-cloud-eip-cost-optimizer

Huawei Cloud EIP (Elastic IP) cost optimization skill using hcloud CLI (KooCLI). 1. List and query EIPs across regions with detailed status 2. Identify idle/unbound EIPs and generate cost optimization reports 3. Set up idle EIP monitoring with webhook/email alerts 4. Generate HTML/JSON cost analysis reports 5. Maintain operation audit logs for compliance Read-only analysis only - NO bandwidth adjustment, tag management, or EIP release/deletion. Triggers include: "EIP cost optimization", "idle EIP analysis", "EIP audit", "cost report", "EIP status query", "EIP list", "EIP monitoring", "EIP alert", "cost analysis", "idle monitoring", "operation audit", "EIP 成本优化", "闲置 EIP 分析", "EIP 审计", "成本报告", "EIP 状态查询", "EIP 查询", "EIP 列表", "EIP 监控", "EIP 告警", "成本分析", "闲置监控", "操作审计"

instalações
1
GitHub Stars
50
Atualizado
22 de set.
huaweicloud
Comunidade

huawei-cloud-flexus-l-deploy-jiuwenswarm

One-click deployment of JiuwenSwarm multi-Agent collaboration platform on Huawei Cloud Flexus L instances. Usage scenarios: When users need to quickly deploy JiuwenSwarm/JiuwenClaw on Huawei Cloud Flexus L instances, when they need to automatically create cloud instances and deploy AI Agent platforms, when they need to configure model APIs and message channels (Xiaoyi/Feishu/DingTalk). Automatically create instances, deploy applications via COC, configure models and message channels. Trigger keywords: JiuwenSwarm deployment, JiuwenClaw deployment, 九问Swarm部署, 九问Claw部署, 一键部署JiuwenSwarm, AI智能体平台部署, 部署九问Swarm, 部署九问Claw,云服务器部署AI平台.

instalações
1
GitHub Stars
50
Atualizado
22 de set.
huaweicloud
Comunidade

huawei-cloud-flexus-l-server-flexusagent-deployment

Deploy AI Agent development platform (Dify) on Huawei Cloud Flexus L instance, providing deployment operations, password management, MaaS model configuration, and workflow import capabilities. Trigger keywords: deploy flexusagent/一键部署Flexus AI Agent开发平台、change password/修改开发平台管理员密码、change dify password/修改dify平台密码、add maas provider/添加MaaS模型供应商、configure maas model/配置MaaS模型、view workflow/查看AI Agent工作流、import workflow/导入AI Agent工作流

instalações
1
GitHub Stars
50
Atualizado
22 de set.