mcpField
A
ai-rag-pipeline

ai-rag-pipeline

github.com/inference-shAgent 工作流7891.0k 次安装2 周前更新
代码仓库

关于 ai-rag-pipeline

ai-rag-pipeline 是使用 inference.sh CLI(belt)构建检索增强生成流程的技能,面向需要结合外部信息与 LLM 生成内容的研究和 Agent 工作流。它提供搜索、内容提取及多来源分析等流程范式。

主要功能

  1. 01组合搜索结果与 LLM 生成回答
  2. 02支持多来源研究与结果汇总
  3. 03从 URL 提取内容并处理
  4. 04提供事实核查与报告流程示例

适用场景

  1. 01根据网络搜索结果生成带依据的回答
  2. 02汇总多个来源并分析异同
  3. 03提取网页内容并生成摘要
  4. 04搜索证据以核查具体主张

安装

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

$npx skills add https://github.com/inference-sh/skills --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