SuperAPI AI 工具集

cli-anything-exa

通用与其它

查看项目

更新于 10-15 15:12

技能介绍

用途

cli-anything-exa 是一个面向 AI 智能体的命令行界面(CLI),封装了 Exa API——一个为 AI 智能体工作流优化的神经搜索引擎。它让智能体能够通过命令行执行网页搜索和内容获取,并以结构化 JSON 输出结果,方便程序化处理。

主要能力

  • 网页搜索:支持多种搜索模式,包括 auto、fast、instant、deep、deep-reasoning。
  • 内容获取:可获取页面的全文、高亮或摘要内容。
  • 分类搜索:支持按 company、people、research-paper、news、personal-site、financial-report 等类别筛选。
  • 过滤与排序:支持按域名包含/排除、发布日期范围、地理位置偏置等条件过滤。
  • JSON 输出:所有命令支持 --json 参数,输出机器可读结果,其中包含 cost_dollars 字段表示每次查询的费用。
  • 交互式 REPL:不带子命令运行时可进入 REPL 模式,直接输入命令。

使用方式

前置条件

  • Python >= 3.10
  • 安装:pip install cli-anything-exa
  • 设置 API 密钥:export EXA_API_KEY="your-api-key"(可在 https://dashboard.exa.ai/api-keys 获取)
  • 也可通过源码安装:pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=exa/agent-harness

命令参考

search — 网页搜索

cli-anything-exa search "<query>" [OPTIONS]

选项:

  • --type:auto|fast|instant|deep|deep-reasoning(默认 auto)
  • --num-results / -n:1–100(默认 10)
  • --category:company|people|research-paper|news|personal-site|financial-report
  • --content:highlights|text|summary|none(默认 highlights)
  • --freshness:smart|always|never(默认 smart)
  • --include-domains DOMAIN:可重复
  • --exclude-domains DOMAIN:可重复
  • --from DATE:ISO 8601 起始发布日期
  • --to DATE:ISO 8601 结束发布日期
  • --location CC:两位国家代码,用于地理偏置

contents — 获取页面内容

cli-anything-exa contents <url> [url ...] [--content text|highlights|summary] [--freshness smart|always|never]

server status — 验证 API 密钥与连通性

cli-anything-exa server status

JSON 输出

所有命令在根级别支持 --json 参数:

cli-anything-exa --json search "latest LLM papers" --num-results 5

常见智能体使用模式

  • 快速关键词查询:cli-anything-exa --json search "site:arxiv.org transformer architectures" --type fast --content highlights
  • 深度研究:cli-anything-exa --json search "EU AI Act compliance requirements 2024" --type deep --content text
  • 学术论文发现:cli-anything-exa --json search "retrieval augmented generation" --category research-paper --num-results 20
  • 公司情报:cli-anything-exa --json search "Anthropic funding history" --category company
  • 新闻监控:cli-anything-exa --json search "AI regulation news" --category news --from 2024-01-01
  • 获取全文用于摘要:cli-anything-exa --json contents https://example.com/article --content text

交互式 REPL

直接运行 cli-anything-exa(不带子命令)进入 REPL,输入命令时无需前缀,输入 exit 或 quit 退出。

适用场景

  • AI 智能体需要执行网页搜索并获取结构化结果。
  • 需要按类别、日期、域名等条件进行精细化搜索。
  • 需要获取页面全文或高亮内容用于后续处理(如摘要)。
  • 需要监控新闻或进行学术论文发现。
  • 需要以 JSON 格式集成到自动化流程中。

限制

  • 需要 Exa API 密钥,且每次查询可能产生费用(JSON 输出中包含 cost_dollars)。
  • --category company 和 --category people 不支持日期或域名排除过滤。
  • --type deep 会触发多步推理,速度较慢但能综合多个来源。
  • highlights 内容模式比 text 模式在 token 效率上高 10 倍,建议在智能体管道中优先使用。
  • 其他未在资料中提及的功能、收费细节、平台支持等暂未提供。