运行时依赖
安装命令
点击复制技能文档
搜索技能 搜索网络并获取针对LLM消费优化的相关结果。 前提条件 Tavily API密钥 - 在https://tavily.com获取您的密钥 在~/.claude/settings.json中添加: { "env": { "TAVILY_API_KEY": "tvly-your-api-key-here" } } 快速开始 使用脚本 ./scripts/search.sh '' 示例: # 基本搜索 ./scripts/search.sh '{"query": "python async patterns"}' # 带选项 ./scripts/search.sh '{"query": "React hooks tutorial", "max_results": 10}' # 高级搜索带过滤 ./scripts/search.sh '{"query": "AI news", "topic": "news", "time_range": "week", "max_results": 10}' # 域名过滤搜索 ./scripts/search.sh '{"query": "machine learning", "include_domains": ["arxiv.org", "github.com"], "search_depth": "advanced"}' 基本搜索 curl --request POST \ --url https://api.tavily.com/search \ --header "Authorization: Bearer $TAVILY_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "query": "latest developments in quantum computing", "max_results": 5 }' 高级搜索 curl --request POST \ --url https://api.tavily.com/search \ --header "Authorization: Bearer $TAVILY_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "query": "machine learning best practices", "max_results": 10, "search_depth": "advanced", "include_domains": ["arxiv.org", "github.com"], "chunks_per_source": 3 }' API 参考 端点 POST https://api.tavily.com/search 头部 Header 值 Authorization Bearer Content-Type application/json 请求体 字段 类型 默认值 描述 query string 必需 搜索查询(保持在400个字符以内) max_results 整数 5 最大结果(0-20) search_depth 字符串 "basic" ultra-fast, fast, basic, advanced topic 字符串 "general" general, news, finance chunks_per_source 整数 3 每个来源的块数(仅限高级/快速) time_range 字符串 null day, week, month, year include_domains 数组 [] 要包含的域名(最多300) exclude_domains 数组 [] 要排除的域名(最多150) include_answer 布尔值 false 包含AI生成的答案 include_raw_content 布尔值 false 包含完整的页面内容 include_images 布尔值 false 包含图像结果 响应格式 { "query": "latest developments in quantum computing", "results": [ { "title": "页面标题", "url": "https://example.com/page", "content": "提取的文本片段...", "score": 0.85 } ], "response_time": 1.2 } 搜索深度 深度 延迟 相关性 内容类型 ultra-fast 最低 较低 NLP摘要 fast 低 良好 块 basic 中等 高 NLP摘要 advanced 较高 最高 块 何时使用每种: ultra-fast:实时聊天,自动补全 fast:需要块但延迟很重要 basic:通用,平衡 advanced:精度很重要(默认推荐) 示例 新闻搜索 curl --request POST \ --url https://api.tavily.com/search \ --header "Authorization: Bearer $TAVILY_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "query": "AI news today", "topic": "news", "time_range": "day", "max_results": 10 }' 域名过滤搜索 curl --request POST \ --url https://api.tavily.com/search \ --header "Authorization: Bearer $TAVILY_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "query": "Python async best practices", "include_domains": ["docs.python.org", "realpython.com", "github.com"], "search_depth": "advanced" }' 带全内容的搜索 curl --request POST \ --url https://api.tavily.com/search \ --header "Authorization: Bearer $TAVILY_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "query": "React hooks tutorial", "max_results": 3, "include_raw_content": true }' 金融搜索 curl --request POST \ --url https://api.tavily.com/search \ --header "Authorization: Bearer $TAVILY_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "query": "AAPL earnings Q4 2024", "topic": "finance", "max_results": 10 }' 提示 保持查询在400个字符以内 - 想搜索查询,而不是提示 将复杂的查询分解为子查询 - 比一个大查询更好的结果 使用include_domains来关注可信来源 使用time_range获取最近的信息 按评分(0-1)筛选以获取最高相关性结果