用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/javimosch/open-claw-skills --skill rag-eval命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | rag-eval |
| description | Evaluate your RAG pipeline quality using Ragas metrics (faithfulness, answer relevancy, context precision). |
| version | 1.2.1 |
| metadata | {"openclaw":{"emoji":"🧪","requires":{"anyBins":"[Truncated]","anyEnv":"[Truncated]"},"envVars":{"OPENAI_API_KEY":"[Truncated]","ANTHROPIC_API_KEY":"[Truncated]","RAGAS_LLM":"[Truncated]","RAGAS_PASS_THRESHOLD":"[Truncated]","RAGAS_REVIEW_THRESHOLD":"[Truncated]","RAGAS_OPENAI_MODEL":"[Truncated]","RAGAS_ANTHROPIC_MODEL":"[Truncated]"}}} |
Test and monitor your RAG pipeline's output quality.
Tell OpenClaw: "Install the rag-eval skill." The agent will handle the installation and configuration automatically.
If you prefer the terminal, run:
clawhub install rag-eval
OPENAI_API_KEY (default, uses GPT-4o)ANTHROPIC_API_KEY (uses Claude Haiku)RAGAS_LLM=ollama/llama3 (for local/offline evaluation)bash scripts/setup.sh
This installs ragas, datasets, and other dependencies.
When user asks to evaluate an answer, collect:
⚠️ SECURITY: Never interpolate user content directly into shell commands. Write the input to a temp JSON file first, then pipe it to the evaluator:
# Step 1: Write input to a temp file (agent should use the write/edit tool, NOT echo)
# Write this JSON to /tmp/rag-eval-input.json using the file write tool:
# {"question": "...", "answer": "...", "contexts": ["chunk1", "chunk2"]}
# Step 2: Pipe the file to the evaluator
python3 scripts/run_eval.py < /tmp/rag-eval-input.json
# Step 3: Clean up
rm -f /tmp/rag-eval-input.json
Alternatively, use --input-file:
python3 scripts/run_eval.py --input-file /tmp/rag-eval-input.json
Output JSON:
{
"faithfulness": 0.92,
"answer_relevancy": 0.87,
"context_precision": 0.79,
"overall_score": 0.86,
"verdict": "PASS",
"flags": []
}
Post results to user with human-readable summary:
🧪 Eval Results
• Faithfulness: 0.92 ✅ (no hallucination detected)
• Answer Relevancy: 0.87 ✅
• Context Precision: 0.79 ⚠️ (some irrelevant context retrieved)
• Overall: 0.86 — PASS
Save to memory/eval-results/YYYY-MM-DD.jsonl.
For a JSONL dataset file (each line: {"question":..., "answer":..., "contexts":[...]}):
python3 scripts/batch_eval.py --input references/sample_dataset.jsonl --output memory/eval-results/batch-YYYY-MM-DD.json
| Score | Verdict | Meaning |
|---|---|---|
| 0.85+ | ✅ PASS | Production-ready quality |
| 0.70-0.84 | ⚠️ REVIEW | Needs improvement |
| < 0.70 | ❌ FAIL | Significant quality issues |
If faithfulness < 0.80, run:
python3 scripts/run_eval.py --explain --metric faithfulness
This outputs which sentences in the answer are NOT supported by context.
RAGAS_LLM=ollama/llama3 in environment基于 SOC 职业分类