← 返回 Skills 市场
wjs028-coder

Double search(Tavily + Kimi)

作者 wjs028-coder · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
110
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install double-search
功能描述
双搜索功能 (Tavily + Kimi) - 支持并行搜索和结果合并
使用说明 (SKILL.md)

Double Search Skill

双重搜索功能,同时使用Tavily和Kimi搜索引擎,提供更全面、准确的搜索结果。

功能特性

  • 双引擎并行搜索:同时使用Tavily和Kimi
  • 智能结果合并:自动合并、去重和排序
  • 异步高效:基于asyncio的高性能实现
  • 错误容错:单个搜索失败不影响整体
  • 灵活配置:支持环境变量和配置文件

快速开始

1. 安装Python依赖

pip install aiohttp python-dotenv

2. 设置环境变量

.env文件中添加:

TAVILY_API_KEY=tvly-xxxxxxxxxxxx
KIMI_API_KEY=your_kimi_api_key_here

或者设置系统环境变量:

export TAVILY_API_KEY="tvly-xxxxxxxxxxxx"
export KIMI_API_KEY="your_kimi_api_key_here"

3. 基本使用

from double_search import DoubleSearcher

async def search_example():
    searcher = DoubleSearcher()

    # 执行搜索
    results = await searcher.search("人工智能发展趋势")

    # 打印结果
    print(f"搜索结果: {results}")

    # 查看各个搜索引擎的结果
    print(f"Tavily结果: {results.get('tavily', [])}")
    print(f"Kimi结果: {results.get('kimi', [])}")

    return results

API文档

DoubleSearcher类

初始化

searcher = DoubleSearcher()

search方法

async def search(
    query: str,
    merge_results: bool = True,
    limit_per_source: int = 5
) -> Dict[str, Any]

参数:

  • query (str): 搜索查询字符串
  • merge_results (bool): 是否合并结果(默认True)
  • limit_per_source (int): 每个搜索源返回的结果数量(默认5)

返回:

{
  "query": "搜索内容",
  "merged_results": [
    {
      "title": "结果标题",
      "url": "https://example.com",
      "snippet": "结果摘要",
      "source": "tavily"
    }
  ],
  "source_breakdown": {
    "tavily": [...],
    "kimi": [...]
  }
}

高级用法

1. 不合并结果

results = await searcher.search(
    query="技术趋势",
    merge_results=False
)

# 结果按搜索源分开
print(results['tavily'])
print(results['kimi'])

2. 限制每个源的结果数量

results = await searcher.search(
    query="市场分析",
    limit_per_source=3
)

3. 自定义结果处理

results = await searcher.search("投资策略")

# 只获取Tavily的结果
tavily_results = results.get('tavily', [])

# 只获取Kimi的结果
kimi_results = results.get('kimi', [])

# 获取合并的结果
all_results = results.get('merged_results', [])

配置管理

环境变量配置

# 必需
TAVILY_API_KEY=tvly-xxxxxxxxxxxx

# 可选(不设置则只使用Tavily)
KIMI_API_KEY=your_kimi_api_key_here

配置文件支持

支持.env文件:

# .env文件示例
TAVILY_API_KEY=tvly-xxxxxxxxxxxx
KIMI_API_KEY=your_kimi_api_key_here

错误处理

async def safe_search(query: str):
    searcher = DoubleSearcher()

    try:
        results = await searcher.search(query)

        if not results['merged_results']:
            return {"error": "搜索无结果", "query": query}

        return results

    except Exception as e:
        return {"error": f"搜索失败: {str(e)}", "query": query}

性能优化

并行搜索效率

  • Tavily和Kimi同时搜索,总时间接近较慢的搜索引擎
  • 适合需要全面结果的场景

结果缓存

from functools import lru_cache

class CachedSearcher(DoubleSearcher):
    @lru_cache(maxsize=100)
    async def search(self, query: str, ...):
        return await super().search(query, ...)

使用场景

1. 内容创作

async def research_topic(topic):
    searcher = DoubleSearcher()
    results = await searcher.search(topic)

    # 分析多个来源
    insights = analyze_results(results)
    return insights

2. 财经分析

async def financial_analysis(ticker):
    searcher = DoubleSearcher()
    query = f"{ticker} 财经分析"
    results = await searcher.search(query)

    # 过滤财经相关结果
    financial_news = filter_financial_content(results)
    return financial_news

3. 代码搜索

async def code_search(problem):
    searcher = DoubleSearcher()
    results = await searcher.search(problem)

    # 优先获取技术相关结果
    technical_results = filter_tech_content(results)
    return technical_results

故障排除

问题1:搜索无结果

# 检查API keys
echo $TAVILY_API_KEY
echo $KIMI_API_KEY

# 验证API keys有效性

问题2:Python模块未找到

# 确保在正确的工作目录
cd ~/.openclaw/skills/double-search

# 检查Python路径
which python3

问题3:依赖缺失

# 安装依赖
pip install aiohttp python-dotenv

版本信息

  • 版本: 1.0.0
  • Python版本: 3.8+
  • 更新日期: 2026-03-27
  • 兼容性: OpenClaw skill系统
安全使用建议
This skill appears to do what it claims: run parallel searches against Tavily and optionally Kimi. Before installing, verify you trust the external endpoints (https://api.tavily.com and https://api.moonshot.cn) because the skill will send your API keys and search queries to them. Note the registry metadata erroneously marks KIMI_API_KEY as required even though Kimi is optional — you can run with only TAVILY_API_KEY. Run install.sh in an environment where pip installs are acceptable (it will install aiohttp and python-dotenv), and avoid supplying high-privilege or unrelated credentials. If you have security concerns, review the included __init__.py (network calls are explicit) or run the code in an isolated environment and use API keys with limited scope. If you want the metadata corrected, request that KIMI_API_KEY be marked optional in registry fields.
功能分析
Type: OpenClaw Skill Name: double-search Version: 1.0.0 The 'double-search' skill is a legitimate implementation of a search aggregator using the Tavily and Kimi (Moonshot AI) APIs. The Python code in `__init__.py` uses standard asynchronous requests via `aiohttp` to official endpoints (api.tavily.com and api.moonshot.cn), and the `install.sh` script performs routine environment checks and dependency installation without any suspicious behavior or obfuscation.
能力评估
Purpose & Capability
Name/description (double-search using Tavily and Kimi) match the code, which calls Tavily and Kimi APIs. One inconsistency: registry-level required env vars list both TAVILY_API_KEY and KIMI_API_KEY as required, while the SKILL.md/README and runtime code treat KIMI_API_KEY as optional (only loads Kimi if KIMI_API_KEY is set). This is likely a metadata inaccuracy rather than malicious behavior.
Instruction Scope
SKILL.md instructions are limited to installing Python deps, setting environment variables or a .env file, and using the provided Python API. The runtime code performs network requests only to the declared search endpoints (https://api.tavily.com/search and https://api.moonshot.cn/v1/chat/completions) and does not attempt to read unrelated system files or secrets.
Install Mechanism
No risky remote downloads. The included install.sh uses pip to install aiohttp and python-dotenv and writes a local .env template; this is standard. There is no download-from-arbitrary-URL or extracted archive behavior.
Credentials
Requests TAVILY_API_KEY (primary) and KIMI_API_KEY. These are proportionate to the skill's function. Minor inconsistency: registry metadata marks both env vars as required, but code & docs treat KIMI_API_KEY as optional — you don't need to provide KIMI if you only want Tavily. No other unrelated credentials are requested.
Persistence & Privilege
Skill does not request always:true nor attempt to modify other skills or system-wide configs. It writes a .env file into its own directory via install.sh (expected), and runs normal Python test code. Autonomous invocation is allowed by default but not combined with other red flags.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install double-search
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /double-search 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of double-search: parallel search and result merging via Tavily + Kimi. - Supports dual-engine parallel search (Tavily and Kimi) for broader, more accurate results - Intelligent result merging: deduplication and sorting - Asynchronous, high-performance implementation - Fault tolerance: single search failure doesn’t affect overall results - Flexible configuration via environment variables or .env file - Simple Python API with advanced usage and troubleshooting guides
元数据
Slug double-search
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Double search(Tavily + Kimi) 是什么?

双搜索功能 (Tavily + Kimi) - 支持并行搜索和结果合并. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 110 次。

如何安装 Double search(Tavily + Kimi)?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install double-search」即可一键安装,无需额外配置。

Double search(Tavily + Kimi) 是免费的吗?

是的,Double search(Tavily + Kimi) 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Double search(Tavily + Kimi) 支持哪些平台?

Double search(Tavily + Kimi) 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Double search(Tavily + Kimi)?

由 wjs028-coder(@wjs028-coder)开发并维护,当前版本 v1.0.0。

💬 留言讨论