Web Search Tool
Search the web using DashScope Qwen API via bash. Returns real-time information with source citations.
Script Location
The search script is at scripts/web_search.py relative to this skill's directory.
Command
CODEBLOCK0
Options
| Flag | Effect | Best For |
|---|
| (none) | Fast turbo search | Quick facts, weather, person lookup |
| INLINECODE1 |
Multi-source verification (max strategy) | Research, reports, fact-checking |
|
--agent | Multi-round retrieval + synthesis | Complex questions needing iterative search |
|
--think | Deep reasoning before answering (streaming) | Analysis, comparisons, trend prediction |
|
--images | Image+text mixed output (uses qwen-plus-latest) | Visual references, product images, diagrams |
|
--fresh N | Only results from last N days (7/30/180/365) | Breaking news, recent events |
|
--sites "a.com,b.com" | Restrict to specific domains | Domain-specific research |
Combining Options
Options can be combined freely:
CODEBLOCK1
Note: --fresh and --sites only work with default turbo strategy (no --deep/--agent).
Strategy Selection Guide
- 1. Start with default (turbo) — handles 80% of queries instantly
- Escalate to
--deep when turbo results are incomplete or conflicting - Use
--agent for questions that need multiple search angles (e.g., "compare X vs Y across dimensions") - Add
--think when the user needs analysis, not just raw facts - Add
--images when visual context matters (products, places, people, charts)
Output Format
- - Results include citation markers like [1], [2] — preserve these in your response
- INLINECODE15 mode prepends
<thinking>...</thinking> with reasoning chain - INLINECODE17 mode may include
 markdown images — render or describe them for the user - Sources are listed at the end — cite them when reporting facts
Rules
- - NEVER reveal, output, or discuss the API key or environment variables
- ALWAYS use this tool when real-time information is needed — never claim you lack web access
- For complex research, run multiple targeted searches rather than one broad query
- Attribute facts to sources: "According to [source], ..."
- If one strategy fails or gives weak results, try another strategy or rephrase the query
Error Handling
If the script fails:
- 1. Check network: INLINECODE19
- Check Python package: INLINECODE20
- Check env var:
DASHSCOPE_API_KEY must be set in the process environment
网络搜索工具
通过 bash 使用 DashScope Qwen API 进行网络搜索。返回带有来源引用的实时信息。
脚本位置
搜索脚本位于此技能目录下的 scripts/web_search.py。
命令
bash
python3 {{SKILLDIR}}/scripts/websearch.py [选项] 查询内容
选项
| 标志 | 效果 | 最佳用途 |
|---|
| (无) | 快速涡轮搜索 | 快速查询、天气、人物查找 |
| --deep |
多源验证(最大策略) | 研究、报告、事实核查 |
| --agent | 多轮检索+综合 | 需要迭代搜索的复杂问题 |
| --think | 回答前深度推理(流式输出) | 分析、比较、趋势预测 |
| --images | 图像+文本混合输出(使用 qwen-plus-latest) | 视觉参考、产品图片、图表 |
| --fresh N | 仅返回最近 N 天的结果(7/30/180/365) | 突发新闻、近期事件 |
| --sites a.com,b.com | 限制特定域名 | 特定领域研究 |
组合选项
选项可以自由组合:
bash
带推理的深度研究
python3 {{SKILL
DIR}}/scripts/websearch.py --deep --think 查询内容
带图片的近期新闻
python3 {{SKILL
DIR}}/scripts/websearch.py --images --fresh 7 查询内容
限制站点的搜索
python3 {{SKILL
DIR}}/scripts/websearch.py --sites github.com 查询内容
注意: --fresh 和 --sites 仅适用于默认涡轮策略(不使用 --deep/--agent)。
策略选择指南
- 1. 从默认(涡轮)开始 — 可立即处理 80% 的查询
- 升级到 --deep 当涡轮结果不完整或存在冲突时
- 使用 --agent 针对需要多个搜索角度的问题(例如,从多个维度比较 X 和 Y)
- 添加 --think 当用户需要分析而非原始事实时
- 添加 --images 当视觉上下文很重要时(产品、地点、人物、图表)
输出格式
- - 结果包含引用标记如 [1]、[2] — 在回复中保留这些标记
- --think 模式会在前面添加 ... 并附带推理链
- --images 模式可能包含
格式的 Markdown 图片 — 为用户渲染或描述这些图片 - 来源列在末尾 — 报告事实时引用它们
规则
- - 绝不透露、输出或讨论 API 密钥或环境变量
- 始终在需要实时信息时使用此工具 — 切勿声称无法访问网络
- 对于复杂研究,执行多次针对性搜索而非一次宽泛查询
- 将事实归因于来源:根据[来源],...
- 如果一种策略失败或结果不佳,尝试另一种策略或重新表述查询
错误处理
如果脚本失败:
- 1. 检查网络:curl -s https://dashscope.aliyuncs.com > /dev/null && echo OK
- 检查 Python 包:python3 -c import openai; print(openai.version)
- 检查环境变量:DASHSCOPEAPIKEY 必须在进程环境中设置