49 lines
1.4 KiB
Markdown
49 lines
1.4 KiB
Markdown
|
|
---
|
|||
|
|
name: tavily-search
|
|||
|
|
description: "通过Tavily API进行网络搜索(Brave的替代方案)。当用户要求搜索网页/查找来源/查找链接且Brave web_search不可用或不需要时使用。"
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
# Tavily Search
|
|||
|
|
|
|||
|
|
Use the bundled script to search the web with Tavily.
|
|||
|
|
|
|||
|
|
## Requirements
|
|||
|
|
|
|||
|
|
- Provide API key via either:
|
|||
|
|
- environment variable: `TAVILY_API_KEY`, or
|
|||
|
|
- `~/.openclaw/.env` line: `TAVILY_API_KEY=...`
|
|||
|
|
|
|||
|
|
## Commands
|
|||
|
|
|
|||
|
|
Run from the OpenClaw workspace:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
# raw JSON (default)
|
|||
|
|
python3 {baseDir}/scripts/tavily_search.py --query "..." --max-results 5
|
|||
|
|
|
|||
|
|
# include short answer (if available)
|
|||
|
|
python3 {baseDir}/scripts/tavily_search.py --query "..." --max-results 5 --include-answer
|
|||
|
|
|
|||
|
|
# stable schema (closer to web_search): {query, results:[{title,url,snippet}], answer?}
|
|||
|
|
python3 {baseDir}/scripts/tavily_search.py --query "..." --max-results 5 --format brave
|
|||
|
|
|
|||
|
|
# human-readable Markdown list
|
|||
|
|
python3 {baseDir}/scripts/tavily_search.py --query "..." --max-results 5 --format md
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## Output
|
|||
|
|
|
|||
|
|
### raw (default)
|
|||
|
|
- JSON: `query`, optional `answer`, `results: [{title,url,content}]`
|
|||
|
|
|
|||
|
|
### brave
|
|||
|
|
- JSON: `query`, optional `answer`, `results: [{title,url,snippet}]`
|
|||
|
|
|
|||
|
|
### md
|
|||
|
|
- A compact Markdown list with title/url/snippet.
|
|||
|
|
|
|||
|
|
## Notes
|
|||
|
|
|
|||
|
|
- Keep `max-results` small by default (3–5) to reduce token/reading load.
|
|||
|
|
- Prefer returning URLs + snippets; fetch full pages only when needed.
|