This skill allows Alice to use the Tavily API to obtain high-quality search results, supporting multiple search modes.
Core Features
- Basic Search (basic): Quickly obtain summaries and results.
- In-depth Research (research): Uses advanced search depth to return more comprehensive JSON data.
- News Mode (news): Obtains the latest news within a specified number of days.
Usage
Run the following command in the terminal:
# 基础搜索 (默认返回 Alice 可直接阅读的文本)
python skills/tavily/tavily_search.py --query "搜索关键词"
In-depth Research Mode (returns detailed JSON)
python skills/tavily/tavily_search.py --query "research topic" --mode research --max-results 10
News Modepython skills/tavily/tavily_search.py --query "hot topics" --mode news --days 3
Restrict Domain Searchpython skills/tavily/tavily_search.py --query "climate change" --include-domains nature.com science.org
## 依赖要求
1. 安装 Python 包: `pip install tavily-python`
2. 环境变量: 需要在项目根目录 `.env` 中配置 `TAVILY_API_KEY`。
## 参数说明
- `--query`, `-q`: 搜索关键词(必填)。
- `--mode`, `-m`: 模式选择,可选 `basic`, `research`, `news`。
- `--max-results`, `-n`: 返回结果数量 (1-20)。
- `--days`, `-d`: 新闻搜索的时间范围。
- `--json`: 在 basic 模式下强制输出 JSON。
- `--include-domains`: 限制搜索的域名列表(空格隔开)。
- `--exclude-domains`: 排除的域名列表。
## 注意事项
Alice 应优先使用默认的 `basic` 模式进行日常问答,仅在需要进行深入研究或处理复杂数据时使用 `research` 模式。