SuperAPI AI 工具集

ai-rag-pipeline

智能体与模型

查看项目

更新于 10-15 08:33

技能介绍

用途

ai-rag-pipeline 是一个用于构建 RAG(Retrieval Augmented Generation,检索增强生成)流水线的技能。它通过 inference.sh CLI(即 belt)把网络搜索工具与大型语言模型连接起来,用于生成更准确、更新且可核验的 AI 回答。

RAG 由三部分组成:

  1. 检索(Retrieval):从外部来源获取相关信息;
  2. 增强(Augmentation):把检索到的上下文加入提示词;
  3. 生成(Generation):LLM 基于上下文生成回答。

主要能力

资料提供的三种 RAG 流水线模式:

  • 模式一:简单搜索加回答。流程为 [用户查询] -> [网络搜索] -> [带上下文的 LLM] -> [回答]。
  • 模式二:多来源研究。流程为 [查询] -> [多个搜索] -> [聚合] -> [LLM 分析] -> [报告]。
  • 模式三:提取加处理。流程为 [URL] -> [内容提取] -> [分块] -> [LLM 摘要] -> [输出]。

资料列出的可用工具:

搜索工具:

  • Tavily Search,应用 ID 为 tavily/search-assistant,适合带答案的 AI 搜索;
  • Exa Search,应用 ID 为 exa/search,适合神经搜索、语义匹配;
  • Exa Answer,应用 ID 为 exa/answer,适合直接的事实性回答。

提取工具:

  • Tavily Extract,应用 ID 为 tavily/extract,适合从 URL 提取干净内容;
  • Exa Extract,应用 ID 为 exa/extract,适合分析网页内容。

LLM 工具:

  • Claude Sonnet 4.5,应用 ID 为 openrouter/claude-sonnet-45,适合复杂分析;
  • Claude Haiku 4.5,应用 ID 为 openrouter/claude-haiku-45,适合快速处理;
  • GPT-4o,应用 ID 为 openrouter/gpt-4o,适合通用场景;
  • Gemini 2.5 Pro,应用 ID 为 openrouter/gemini-25-pro,适合长上下文。

文档中还给出了若干流水线示例的用途:基础 RAG 流水线(先搜索再生成带引用的回答)、多来源研究(合并 Tavily 与 Exa 结果做平衡分析)、URL 内容分析(提取多个 URL 内容后提取关键洞见)、事实核查(先检索证据再给出真伪判定)、研究报告生成器(多角度检索后生成结构化报告)、带来源的快速回答(用 Exa Answer 回答直接事实问题)。

使用方式

资料给出的安装与前置步骤:

  1. 安装 belt CLI 技能:npx skills add belt-sh/cli
  2. 需要 inference.sh CLI(belt),安装说明见资料所指位置;
  3. 登录:belt login

基础 RAG 流水线示例(保持原样):

# 1. Search for information
SEARCH_RESULT=$(belt app run tavily/search-assistant --input '{
  "query": "What are the latest breakthroughs in quantum computing 2024?"
}')

# 2. Generate grounded response
belt app run openrouter/claude-sonnet-45 --input "{
  \"prompt\": \"You are a research assistant. Based on the following search results, provide a comprehensive summary with citations.\n\nSearch Results:\n$SEARCH_RESULT\n\nProvide a well-structured summary with source citations.\"
}"

多来源研究示例(保持原样):

TAVILY=$(belt app run tavily/search-assistant --input '{"query": "electric vehicle market trends 2024"}')
EXA=$(belt app run exa/search --input '{"query": "EV market analysis latest reports"}')

belt app run openrouter/claude-sonnet-45 --input "{
  \"prompt\": \"Analyze these research results and identify common themes and contradictions.\n\nSource 1 (Tavily):\n$TAVILY\n\nSource 2 (Exa):\n$EXA\n\nProvide a balanced analysis with sources.\"
}"

URL 内容分析示例(保持原样):

CONTENT=$(belt app run tavily/extract --input '{
  "urls": [
    "https://example.com/research-paper",
    "https://example.com/industry-report"
  ]
}')

belt app run openrouter/claude-sonnet-45 --input "{
  \"prompt\": \"Analyze these documents and extract key insights:\n\n$CONTENT\n\nProvide:\n1. Key findings\n2. Data points\n3. Recommendations\"
}"

事实核查示例(保持原样):

CLAIM="AI will replace 50% of jobs by 2030"

EVIDENCE=$(belt app run tavily/search-assistant --input "{
  \"query\": \"$CLAIM evidence studies research\"
}")

belt app run openrouter/claude-sonnet-45 --input "{
  \"prompt\": \"Fact-check this claim: '$CLAIM'\n\nBased on the following evidence:\n$EVIDENCE\n\nProvide:\n1. Verdict (True/False/Partially True/Unverified)\n2. Supporting evidence\n3. Contradicting evidence\n4. Sources\"
}"

带来源的快速回答示例(保持原样):

belt app run exa/answer --input '{
  "question": "What is the current market cap of NVIDIA?"
}'

可复用的研究函数模板(保持原样):

#!/bin/bash
# research.sh - Reusable research function

research() {
  local query="$1"

  local results=$(belt app run tavily/search-assistant --input "{\"query\": \"$query\"}")

  belt app run openrouter/claude-haiku-45 --input "{
    \"prompt\": \"Summarize: $results\"
  }"
}

research "your query here"

资料还列出相关技能安装命令:

  • npx skills add inference-sh/skills@web-search
  • npx skills add inference-sh/skills@llm-models
  • npx skills add inference-sh/skills@ai-content-pipeline
  • npx skills add inference-sh/skills@infsh-cli

以及查看应用列表命令:belt app list。

最佳实践(摘自资料)

  1. 查询优化:避免过于含糊(如 AI news),应具体且带上下文(如 latest developments in large language models January 2024)。
  2. 上下文管理:检索结果过长时先用模型摘要,再送入分析模型。
  3. 来源标注:要求 LLM 以 Source Name 格式引用来源。
  4. 迭代研究:先广泛搜索,再针对初轮结果深入检索。

适用场景

资料示例覆盖:基础检索问答、多来源交叉研究、URL 文档内容分析、事实核查、研究报告生成、直接事实问答等。

限制

资料未提供关于收费、价格、平台限制、性能效果或使用配额的具体信息,这些内容暂未提供。资料亦未提供各模型的参数、速率限制或错误处理说明。