ExaTools 使 Agent 能够使用 Exa 搜索网络、检索 URL 内容、查找相似内容并获得 AI 驱动的答案。

前提条件

以下示例需要 exa-py 库和 API 密钥,可在 Exa 获取。

pip install -U exa-py
export EXA_API_KEY=***

示例

以下 Agent 将在 Exa 中搜索 AAPL 新闻并打印响应。

cookbook/tools/exa_tools.py
from agno.agent import Agent
from agno.tools.exa import ExaTools

agent = Agent(
    tools=[ExaTools(
        include_domains=["cnbc.com", "reuters.com", "bloomberg.com"],
        category="news",
        text_length_limit=1000,
    )],
    show_tool_calls=True,
)
agent.print_response("Search for AAPL news", markdown=True)

Toolkit 函数

函数描述
search_exa使用可选的类别过滤搜索 Exa
get_contents从特定 URL 检索详细内容
find_similar查找与给定 URL 相似的内容
exa_answer使用 Exa 搜索结果获取 AI 驱动的答案

Toolkit 参数

参数类型默认值描述
searchboolTrue启用搜索功能
get_contentsboolTrue启用内容检索
find_similarboolTrue启用查找相似内容功能
answerboolTrue启用 AI 驱动的答案
textboolTrue在结果中包含文本内容
text_length_limitint1000每个结果的最大文本长度
highlightsboolTrue包含高亮片段
summaryboolFalse包含结果摘要
num_resultsOptional[int]None默认结果数量
livecrawlstr"always"Livecrawl 行为
start_crawl_dateOptional[str]None包含在此日期之后抓取的结果 (年-月-日)
end_crawl_dateOptional[str]None包含在此日期之前抓取的结果 (年-月-日)
start_published_dateOptional[str]None包含在此日期之后发布的结果 (年-月-日)
end_published_dateOptional[str]None包含在此日期之前发布的the results (年-月-日)
use_autopromptOptional[bool]None启用 autoprompt 功能
typeOptional[str]None内容类型过滤 (例如: article, blog, video)
categoryOptional[str]None类别过滤 (例如: news, research paper)
include_domainsOptional[List[str]]None将结果限制在这些域名内
exclude_domainsOptional[List[str]]None排除这些域名的结果
show_resultsboolFalse记录搜索结果以用于调试
modelOptional[str]None要使用的搜索模型 (‘exa’ or ‘exa-pro’)

类别

可用于过滤的类别:

  • εταιρεία (company)
  • 文章 (research paper)
  • 新闻 (news)
  • pdf
  • github
  • 鸣叫 (tweet)
  • 个人网站 (personal site)
  • 领英个人资料 (linkedin profile)
  • 金融报告 (financial report)

开发者资源