LlamaIndex 集成
将 Scavio 与 LlamaIndex 集成,为你的 RAG 管道和 Agent 提供跨 Google、Google News、Reddit、YouTube 和 Amazon 的实时网络搜索—以干净的 Document 对象返回,随时可索引或推理。
为 RAG 提供最新数据
llama-index-tools-scavio 包将每一次 Scavio 搜索都转换为 LlamaIndex Document—是覆盖更广的、经济高效的 Tavily 与 SerpAPI 替代方案。简介
llama-index-tools-scavio 包提供了带有五个搜索工具的 ScavioToolSpec。将它们交给任意 LlamaIndex Agent,或在数据管道中直接调用它们。
分步集成指南
步骤 1:安装该包
Bash
pip install llama-index-tools-scavio步骤 2:设置你的 API 密钥
在 dashboard.scavio.dev 获取密钥(免费积分,无需信用卡),然后将其设置为环境变量:
Bash
export SCAVIO_API_KEY=sk_live_...步骤 3:基本用法
Python
from llama_index.tools.scavio import ScavioToolSpec
tool_spec = ScavioToolSpec() # reads SCAVIO_API_KEY
docs = tool_spec.search("best real-time search API for AI agents", max_results=5)
for doc in docs:
print(doc.text, doc.metadata["url"])可用工具
ScavioToolSpec 暴露以下函数,每个函数返回一个 Document 对象列表:
| 工具 | 描述 |
|---|---|
search | Google SERP—实时自然网络结果 |
news | Google News—关于某话题的最新文章 |
reddit_search | Reddit 帖子—社区讨论与情绪 |
youtube_search | YouTube—视频、频道、播放列表 |
amazon_search | Amazon—商品列表 |
与 Agent 一起使用
Python
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.scavio import ScavioToolSpec
agent = FunctionAgent(
tools=ScavioToolSpec().to_tool_list(),
llm=OpenAI(model="gpt-5.5"),
system_prompt="You are a research assistant. Use Scavio for fresh web data.",
)
response = await agent.run(
"What are people on Reddit saying about Tavily alternatives?"
)高级示例
将实时搜索结果直接加载到向量索引中:
Python
from llama_index.core import VectorStoreIndex
from llama_index.tools.scavio import ScavioToolSpec
docs = ScavioToolSpec().search("open-source agent frameworks 2026", max_results=10)
index = VectorStoreIndex.from_documents(docs)
answer = index.as_query_engine().query("Which framework is most popular and why?")
print(answer)通过 MCP 使用所有端点
需要 Walmart、TikTok、Instagram、Maps、Shopping 等更多能力?让任意 LlamaIndex Agent 指向 Scavio 托管的 MCP 服务器,即可获得完整目录。
Scavio + LlamaIndex 的优势
- Document 原生:结果直接进入 RAG。
- Agent 就绪:
to_tool_list()即可上手。 - 多平台:一个密钥涵盖网络、新闻、社交、购物。
- 经济高效:大多数调用仅需一个积分。
后续步骤
- Python SDK—这些工具所封装的客户端
- MCP 集成—完整工具目录