mcpField
A
ai-rag-pipeline

ai-rag-pipeline

github.com/magentoshAgent 工作流444 次安装12 周前更新
代码仓库

关于 ai-rag-pipeline

通过 inference.sh 的 belt 命令行组合搜索、内容提取与 LLM,构建检索增强生成(RAG)流程,适合研究和报告生成等任务。示例涵盖多来源检索、网页内容分析和事实核查。

主要功能

  1. 01组合搜索与 LLM 生成
  2. 02从 URL 提取内容
  3. 03汇总多个搜索来源
  4. 04构建事实核查流程
  5. 05生成研究报告

适用场景

  1. 01基于网页资料回答问题
  2. 02比较多个来源并撰写报告
  3. 03分析指定 URL 的内容
  4. 04查找证据核查声明

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/magentosh/superpowers --skill ai-rag-pipeline

安装后在 Claude Code 中输入/ai-rag-pipeline确认已加载。

详细介绍

安装 belt CLI 技能: npx skills add belt-sh/cli

AI RAG 流水线

通过 inference.sh CLI 构建 RAG(检索增强生成)流水线。

AI RAG 流水线

快速入门

需要 inference.sh CLI(belt)。安装说明

belt login

# Simple RAG: Search + LLM
SEARCH=$(belt app run tavily/search-assistant --input '{"query": "latest AI developments 2024"}')
belt app run openrouter/claude-sonnet-45 --input "{
  \"prompt\": \"Based on this research, summarize the key trends: $SEARCH\"
}"

什么是 RAG?

RAG 结合了:

  1. 检索:从外部来源获取相关信息
  2. 增强:将检索到的上下文添加到提示词中
  3. 生成:大模型利用上下文生成回复

这样可以生成更准确、及时且可验证的 AI 回复。

RAG 流水线模式

模式 1:简单搜索 + 回答
[User Query] -> [Web Search] -> [LLM with Context] -> [Answer]
模式 2:多源研究
[Query] -> [Multiple Searches] -> [Aggregate] -> [LLM Analysis] -> [Report]
模式 3:提取 + 处理
[URLs] -> [Content Extraction] -> [Chunking] -> [LLM Summary] -> [Output]

可用工具

搜索工具
工具应用 ID最适合
Tavily Searchtavily/search-assistant提供答案的 AI 驱动搜索
Exa Searchexa/search神经搜索、语义匹配
Exa Answerexa/answer直接提供事实性答案
提取工具
工具应用 ID最适合
Tavily Extracttavily/extract从 URL 提取干净内容
Exa Extractexa/extract分析网页内容
大模型工具
模型应用 ID最适合
Claude Sonnet 4.5openrouter/claude-sonnet-45复杂分析
Claude Haiku 4.5openrouter/claude-haiku-45快速处理
GPT-4oopenrouter/gpt-4o通用用途
Gemini 2.5 Proopenrouter/gemini-25-pro长上下文

流水线示例

基础 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.

Search Results:
$SEARCH_RESULT

Provide a well-structured summary with source citations.\"
}"
多源研究
# Search multiple sources
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"}')

# Combine and analyze
belt app run openrouter/claude-sonnet-45 --input "{
  \"prompt\": \"Analyze these research results and identify common themes and contradictions.

Source 1 (Tavily):
$TAVILY

Source 2 (Exa):
$EXA

Provide a balanced analysis with sources.\"
}"
URL 内容分析
# 1. Extract content from specific URLs
CONTENT=$(belt app run tavily/extract --input '{
  "urls": [
    "https://example.com/research-paper",
    "https://example.com/industry-report"
  ]
}')

# 2. Analyze extracted content
belt app run openrouter/claude-sonnet-45 --input "{
  \"prompt\": \"Analyze these documents and extract key insights:

$CONTENT

Provide:
1. Key findings
2. Data points
3. Recommendations\"
}"
事实核查流水线
# Claim to verify
CLAIM="AI will replace 50% of jobs by 2030"

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

# 2. Verify claim
belt app run openrouter/claude-sonnet-45 --input "{
  \"prompt\": \"Fact-check this claim: '$CLAIM'

Based on the following evidence:
$EVIDENCE

Provide:
1. Verdict (True/False/Partially True/Unverified)
2. Supporting evidence
3. Contradicting evidence
4. Sources\"
}"
研究报告生成器
TOPIC="Impact of generative AI on creative industries"

# 1. Initial research
OVERVIEW=$(belt app run tavily/search-assistant --input "{\"query\": \"$TOPIC overview\"}")
STATISTICS=$(belt app run exa/search --input "{\"query\": \"$TOPIC statistics data\"}")
OPINIONS=$(belt app run tavily/search-assistant --input "{\"query\": \"$TOPIC expert opinions\"}")

# 2. Generate comprehensive report
belt app run openrouter/claude-sonnet-45 --input "{
  \"prompt\": \"Generate a comprehensive research report on: $TOPIC

Research Data:
== Overview ==
$OVERVIEW

== Statistics ==
$STATISTICS

== Expert Opinions ==
$OPINIONS

Format as a professional report with:
- Executive Summary
- Key Findings
- Data Analysis
- Expert Perspectives
- Conclusion
- Sources\"
}"
带来源的快速回答
# Use Exa Answer for direct factual questions
belt app run exa/answer --input '{
  "question": "What is the current market cap of NVIDIA?"
}'

最佳实践

1. 查询优化
# Bad: Too vague
"AI news"

# Good: Specific and contextual
"latest developments in large language models January 2024"
2. 上下文管理
# Summarize long search results before sending to LLM
SEARCH=$(belt app run tavily/search-assistant --input '{"query": "..."}')

# If too long, summarize first
SUMMARY=$(belt app run openrouter/claude-haiku-45 --input "{
  \"prompt\": \"Summarize these search results in bullet points: $SEARCH\"
}")

# Then use summary for analysis
belt app run openrouter/claude-sonnet-45 --input "{
  \"prompt\": \"Based on this research summary, provide insights: $SUMMARY\"
}"
3. 来源归属

始终要求大模型引用来源:

belt app run openrouter/claude-sonnet-45 --input '{
  "prompt": "... Always cite sources in [Source Name](URL) format."
}'
4. 迭代式研究
# First pass: broad search
INITIAL=$(belt app run tavily/search-assistant --input '{"query": "topic overview"}')

# Second pass: dive deeper based on findings
DEEP=$(belt app run tavily/search-assistant --input '{"query": "specific aspect from initial search"}')

流水线模板

Agent 研究工具
#!/bin/bash
# research.sh - Reusable research function

research() {
  local query="$1"

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

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

research "your query here"

相关技能

# Web search tools
npx skills add inference-sh/skills@web-search

# LLM models
npx skills add inference-sh/skills@llm-models

# Content pipelines
npx skills add inference-sh/skills@ai-content-pipeline

# Full platform skill
npx skills add inference-sh/skills@infsh-cli

浏览所有应用:belt app list

文档

评论

支持 Markdown