跳转至

Exa 搜索

Exa AI 是一个 web_search 提供商。它提供 搜索模式 中描述的 auto、neural、fast、deep、deep-reasoning 和 instant 搜索模式。它还内置内容提取功能(高亮、文本、摘要)。

安装插件

openclaw plugins install @openclaw/exa-plugin

安装会自动应用于正在运行的 Gateway;否则将在下次启动时生效。参见 应用更改并检查。

获取 API 密钥

1. 创建账户

在 exa.ai 注册,并从您的仪表板生成 API 密钥。

2. 存储密钥

在 Gateway 环境中设置 EXA_API_KEY,或通过以下方式配置:

openclaw configure --section web

配置

{
  plugins: {
    entries: {
      exa: {
        config: {
          webSearch: {
            apiKey: "exa-...", // optional if EXA_API_KEY is set
            baseUrl: "https://api.exa.ai", // optional; OpenClaw appends /search
          },
        },
      },
    },
  },
  tools: {
    web: {
      search: {
        provider: "exa",
      },
    },
  },
}

环境变量替代方案: 在 Gateway 环境中设置 EXA_API_KEY。对于 gateway 安装,请将其放在 ~/.openclaw/.env 中。参见 环境变量。

覆盖 Base URL

设置 plugins.entries.exa.config.webSearch.baseUrl,可将 Exa 搜索请求路由到兼容的代理或备用端点。OpenClaw 会通过为裸主机添加 https:// 前缀来规范化主机,并在路径未以 /search 结尾时追加 /search。解析后的端点是搜索缓存键的一部分,因此来自不同端点的结果绝不会共享。

工具参数

query string (path) 必填
搜索查询。
count number (path) 默认:5
要返回的结果数(1-100,受 Exa 搜索类型限制)。
type 'auto' | 'neural' | 'fast' | 'deep' | 'deep-reasoning' | 'instant' (path)
搜索模式。
freshness 'day' | 'week' | 'month' | 'year' (path)
时间过滤器。不能与 date_after/date_before 组合使用。
date_after string (path)
此日期之后的结果(YYYY-MM-DD)。
date_before string (path)
此日期之前的结果(YYYY-MM-DD)。
contents object (path)
内容提取选项(见下文)。

内容提取

传入 contents 对象以控制结果中提取的内容:

await web_search({
  query: "transformer architecture explained",
  type: "neural",
  contents: {
    text: true, // full page text
    highlights: { numSentences: 3 }, // key sentences
    summary: true, // AI summary
  },
});
内容选项 类型 描述
text boolean \| { maxCharacters } 提取完整页面文本
highlights boolean \| { maxCharacters, query, numSentences, highlightsPerUrl } 提取关键句子
summary boolean \| { query } AI 生成的摘要

如果省略 contents,Exa 默认为 { highlights: true },因此结果将包含关键句子摘录。结果描述会优先从 highlights 解析,然后是 summary,再是完整文本——以最先可用者为准。结果在可用时还会保留 Exa API 响应中的原始 highlightScores 和 summary 字段。

搜索模式

模式 描述
auto Exa 选择最佳模式(默认)
neural 基于语义/含义的搜索
fast 快速关键词搜索
deep 彻底的深度搜索
deep-reasoning 带推理的深度搜索
instant 最快的结果

备注

  • count 最多接受 100,受 Exa 搜索类型限制。
  • 结果默认缓存 15 分钟。配置共享的 tools.web.search.cacheTtlMinutes(分钟)和 tools.web.search.timeoutSeconds(默认 30 秒),以更改所有 web_search 提供商(包括 Exa)的缓存和请求超时。

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 cl/openclaw