微算力 · API 导航与自营网关
API 接入 EN
未登录登录
📚

企业级知识库智能问答,零幻觉

Ragie.ai-RAG · v1.0.0
效率 安全 A 级 作者 hatim-be 公开目录收录
1.2k 下载 0 安装 3.6k 收藏 12 浏览

简介

基于 Ragie.ai 的检索增强生成(RAG)技能,支持文档上传、向量化索引与严格基于检索结果的智能问答,杜绝幻觉。

原始描述

Execute Retrieval-Augmented Generation (RAG) using Ragie.ai. Use this skill whenever the user wants to: - Search their knowledge base - Ask questions about u...

通过你的 Agent 添加

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/ragie-ai-rag/
Codex CLI~/.codex/skills/ragie-ai-rag/
DeepSeek Harness~/.agents/skills/ragie-ai-rag/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

Ragie-RAG 是一个完整的检索增强生成(RAG)工作流技能,以 Ragie.ai 为后端基础设施。它覆盖文档生命周期的全链条管理:

文档摄取:支持本地文件(PDF、文本等)或 URL 摄取,自动完成分块、嵌入生成与向量索引。通过 Python 脚本触发 ingestion,并轮询状态直至 ready。

检索问答:执行语义检索(--top-k 6 --rerank 默认启用重排序),将检索到的文本块与用户问题拼接成严格受限的提示词,强制模型仅基于检索内容作答。

文档管理:支持列出、查询状态、删除文档等运维操作。

显著优点

  1. 严格的 grounded answering 原则:明确禁止无检索直接回答,从源头阻断幻觉。
  2. 确定性工作流:Case A/B/C 三段式决策树(摄取→管理→检索),逻辑清晰,便于审计与调试。
  3. 内置安全设计:API 密钥强制从环境变量加载,禁止日志暴露敏感信息,符合生产环境合规要求。
  4. 模块化架构:文档处理(Ragie)与提示工程(Agent)职责分离,便于独立升级或替换后端。
  5. 完善的错误处理:覆盖 404/422/429/5xx 等常见错误码,具备重试与优雅降级机制。

潜在缺点与局限性

  1. 外部依赖单一:完全绑定 Ragie.ai 服务,若其 API 稳定性或定价策略变化,迁移成本较高。
  2. 实时性受限:文档摄取后需轮询等待索引完成,大文件或高并发场景下延迟不可控。
  3. 无多模态能力:当前仅支持文本,未涉及图像、表格、音频等富媒体内容的原生处理。
  4. 检索质量瓶颈:最终答案质量受限于 embedding 模型与 reranker 性能,复杂多跳推理场景可能召回不足。

适合人群

  • 企业知识库问答场景(HR 政策、产品手册、技术文档)
  • 对答案可溯源、可审计有强合规要求的金融、法律、医疗行业
  • 需要快速上线 RAG 原型,但缺乏自研向量基础设施的中小团队

常规风险

  • 数据驻留与隐私:上传文档至第三方 SaaS,需评估数据跨境与 retention 政策。
  • 提示注入:虽通过 "仅使用上下文" 指令缓解,但恶意构造的检索结果仍可能诱导模型输出有害内容。
  • 索引延迟导致的 stale 回答:若文档更新频繁,用户可能基于旧版本获得过时信息。

技能正文


name: ragie-rag description: | Execute Retrieval-Augmented Generation (RAG) using Ragie.ai. Use this skill whenever the user wants to:

  • Search their knowledge base
  • Ask questions about uploaded documents
  • Upload documents to Ragie
  • Retrieve context from Ragie
  • Perform grounded answering using stored documents
  • List, check status, or delete Ragie documents

This skill manages the full Ragie.ai API lifecycle including ingestion, retrieval, and grounded answer construction.

Ragie.ai RAG Skill (OpenClaw Optimized)

This skill enables grounded question answering using Ragie.ai as a RAG backend.

Ragie handles:

  • Document chunking
  • Embedding
  • Vector indexing
  • Retrieval
  • Optional reranking

The agent handles:

  • Deciding when to ingest
  • Triggering retrieval
  • Constructing grounded prompts
  • Producing final answers

Core Principles

  1. Never answer without retrieval.
  2. Never hallucinate information not present in retrieved chunks.
  3. Always cite the document_name when referencing specific facts.
  4. If retrieval returns zero relevant chunks, explicitly say:

    "I don't have that information in the current knowledge base."

  5. Do not expose API keys or raw API payloads in final answers.

Deterministic Workflow

Case A — User Provides a File or URL

IF the user provides:

  • A file
  • A document path
  • A PDF/URL to ingest

THEN:

  1. Execute ingestion:

    python `skills/scripts/ingest.py` --file <path> --name "<document_name>"
    

    OR

    python `skills/scripts/ingest.py` --url "<url>" --name "<document_name>"
    
  2. Capture returned document_id.

  3. Poll document status:

    python `skills/scripts/manage.py` status --id <document_id>
    

    Repeat until status == ready.

  4. Proceed to Retrieval (Case C).


Case B — User Requests Document Management

List documents

python `skills/scripts/manage.py` list

Check document status

python `skills/scripts/manage.py` status --id <document_id>

Delete a document

python `skills/scripts/manage.py` delete --id <document_id>

Return structured results to the user.


Case C — Retrieval (Grounded Question Answering)

Execute:

python `skills/scripts/retrieve.py` \
  --query "<user_question>" \
  --top-k 6 \
  --rerank

Optional flags:

  • --partition <name>
  • --filter '{"key":"value"}'

Retrieval Output Format

Expected output:

[
  {
    "text": "...",
    "score": 0.87,
    "document_name": "Policy Handbook",
    "document_id": "doc_abc123"
  }
]

Grounded Prompt Construction

After retrieval:

  1. Extract all chunk text.
  2. Concatenate with separators.
  3. Construct this prompt:
SYSTEM:
You are a helpful assistant.
Answer using ONLY the context provided below.
If the context does not contain the answer, say:
"I don't have that information in the current knowledge base."

CONTEXT:
[chunk 1 text]
---
[chunk 2 text]
---
...

USER QUESTION:
{original user question}
  1. Generate final answer.
  2. Cite document_name when referencing information.

Output Contract

The final response MUST:

  • Be grounded only in retrieved chunks
  • Cite document_name for factual claims
  • Avoid hallucinations
  • Avoid mentioning internal execution steps
  • Avoid exposing API keys or raw responses
  • Clearly state when information is missing

If no chunks are returned:

I don't have that information in the current knowledge base.

API Reference

Base URL:

https://api.ragie.ai
Operation Method Endpoint
Ingest file POST /documents
Ingest URL POST /documents/url
Retrieve chunks POST /retrievals
List documents GET /documents
Get document GET /documents/{id}
Delete document DELETE /documents/{id}

Error Handling

HTTP Code Meaning Action
404 Document not found Verify document_id
422 Invalid payload Validate request schema
429 Rate limited Retry with backoff
5xx Server error Retry or check Ragie status

If ingestion fails:

  • Report failure clearly.
  • Do not proceed to retrieval.

If retrieval fails:

  • Retry once.
  • If still failing, inform user.

Decision Rules Summary

  1. If user uploads content → ingest → wait until ready → retrieve.
  2. If user asks question → retrieve immediately.
  3. If zero chunks → state knowledge gap.
  4. Always use reranking unless explicitly disabled.
  5. Never answer without retrieval.

Advanced Usage

  • Use metadata filter to narrow retrieval scope.
  • Use partitions to separate tenant data.
  • Use recency_bias only when time relevance matters.
  • Adjust top_k depending on query complexity.

Security

  • API keys must be loaded from environment variables.
  • .env must not be committed.
  • Do not log sensitive headers.

Summary

This skill provides:

  • Deterministic ingestion
  • Deterministic retrieval
  • Strict grounded answering
  • Complete Ragie lifecycle management
  • Safe and hallucination-resistant RAG execution

End of Skill.

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

ragknowledge-basedocument-retrievalgrounded-answeringvector-searchenterprise-ai

同类 Skill