Loading...
Loading...
使用网页搜索与LLM构建RAG(Retrieval Augmented Generation,检索增强生成)管道。工具包括:Tavily Search、Exa Search、Exa Answer,以及通过OpenRouter调用的Claude、GPT-4、Gemini。核心能力:调研、事实核查、基于事实的响应、知识检索。适用场景:AI Agent、调研助手、事实核查工具、知识库。相关触发词:rag、retrieval augmented generation、grounded ai、搜索与回答、调研Agent、事实核查、知识检索、AI调研、搜索+LLM、基于网页的AI、Perplexity替代方案、带来源的AI、引用、调研管道
npx skill4agent add skill-zero/s ai-rag-pipeline
curl -fsSL https://cli.inference.sh | sh && infsh login
# Simple RAG: Search + LLM
SEARCH=$(infsh app run tavily/search-assistant --input '{"query": "latest AI developments 2024"}')
infsh app run openrouter/claude-sonnet-45 --input "{
\"prompt\": \"Based on this research, summarize the key trends: $SEARCH\"
}"[用户查询] -> [网页搜索] -> [带上下文的LLM] -> [回答][查询] -> [多轮搜索] -> [结果聚合] -> [LLM分析] -> [报告][URL列表] -> [内容提取] -> [内容分块] -> [LLM总结] -> [输出]| 工具 | 应用ID | 最佳适用场景 |
|---|---|---|
| Tavily Search | | 基于AI的搜索与回答 |
| Exa Search | | 神经搜索、语义匹配 |
| Exa Answer | | 直接事实性回答 |
| 工具 | 应用ID | 最佳适用场景 |
|---|---|---|
| Tavily Extract | | 从URL提取干净内容 |
| Exa Extract | | 网页内容分析 |
| 模型 | 应用ID | 最佳适用场景 |
|---|---|---|
| Claude Sonnet 4.5 | | 复杂分析 |
| Claude Haiku 4.5 | | 快速处理 |
| GPT-4o | | 通用场景 |
| Gemini 2.5 Pro | | 长上下文处理 |
# 1. 搜索信息
SEARCH_RESULT=$(infsh app run tavily/search-assistant --input '{
"query": "What are the latest breakthroughs in quantum computing 2024?"
}')
# 2. 生成基于事实的响应
infsh 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.\"
}"# 搜索多个来源
TAVILY=$(infsh app run tavily/search-assistant --input '{"query": "electric vehicle market trends 2024"}')
EXA=$(infsh app run exa/search --input '{"query": "EV market analysis latest reports"}')
# 合并结果并分析
infsh 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.\"
}"# 1. 从指定URL提取内容
CONTENT=$(infsh app run tavily/extract --input '{
"urls": [
"https://example.com/research-paper",
"https://example.com/industry-report"
]
}')
# 2. 分析提取的内容
infsh 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="AI will replace 50% of jobs by 2030"
# 1. 搜索证据
EVIDENCE=$(infsh app run tavily/search-assistant --input "{
\"query\": \"$CLAIM evidence studies research\"
}")
# 2. 验证主张
infsh 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. 初步调研
OVERVIEW=$(infsh app run tavily/search-assistant --input "{\"query\": \"$TOPIC overview\"}")
STATISTICS=$(infsh app run exa/search --input "{\"query\": \"$TOPIC statistics data\"}")
OPINIONS=$(infsh app run tavily/search-assistant --input "{\"query\": \"$TOPIC expert opinions\"}")
# 2. 生成完整报告
infsh 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\"
}"# 对事实性问题使用Exa Answer
infsh app run exa/answer --input '{
"question": "What is the current market cap of NVIDIA?"
}'# 不佳:过于模糊
"AI news"
# 优秀:具体且有上下文
"latest developments in large language models January 2024"# 在发送给LLM之前先总结长搜索结果
SEARCH=$(infsh app run tavily/search-assistant --input '{"query": "..."}')
# 如果结果过长,先进行总结
SUMMARY=$(infsh app run openrouter/claude-haiku-45 --input "{
\"prompt\": \"Summarize these search results in bullet points: $SEARCH\"
}")
# 再使用总结结果进行分析
infsh app run openrouter/claude-sonnet-45 --input "{
\"prompt\": \"Based on this research summary, provide insights: $SUMMARY\"
}"infsh app run openrouter/claude-sonnet-45 --input '{
"prompt": \"... Always cite sources in [Source Name](URL) format.\"
}'# 第一轮:宽泛搜索
INITIAL=$(infsh app run tavily/search-assistant --input '{"query": "topic overview"}')
# 第二轮:基于初步发现深入研究
DEEP=$(infsh app run tavily/search-assistant --input '{"query": "specific aspect from initial search"}')#!/bin/bash
# research.sh - 可复用的调研函数
research() {
local query="$1"
# 搜索
local results=$(infsh app run tavily/search-assistant --input "{\"query\": \"$query\"}")
# 分析
infsh app run openrouter/claude-haiku-45 --input "{
\"prompt\": \"Summarize: $results\"
}"
}
research "your query here"# 网页搜索工具
npx skills add inference-sh/skills@web-search
# LLM模型
npx skills add inference-sh/skills@llm-models
# 内容管道
npx skills add inference-sh/skills@ai-content-pipeline
# 完整平台技能
npx skills add inference-sh/skills@inference-shinfsh app list