用途:这是一份面向开发者的 Tavily 集成参考文档,用于在编码助手(如 Claude Code、Cursor)辅助下构建生产可用的 Tavily 集成。Tavily 是面向 LLM 的搜索 API,让 AI 应用获取实时网络数据。
安装:Python 使用 pip install tavily-python;JavaScript 使用 npm install @tavily/core。
客户端初始化:Python 中 from tavily import TavilyClient,client = TavilyClient() 默认读取 TAVILY_API_KEY 环境变量;可传 project_id 做用量归类;并行查询可用 AsyncTavilyClient。
方法选择:自定义智能体/工作流中,网页搜索结果用 search(),指定 URL 内容用 extract(),整站内容用 crawl(),站点 URL 发现用 map();开箱即用的研究用 research()。
关键参数:search() 支持 query(建议 400 字符内)、max_results、search_depth(ultra-fast/fast/basic/advanced)、include_domains、exclude_domains、time_range。extract() 支持 urls(最多 20)、extract_depth、query、chunks_per_source(1-5)。crawl() 支持 url、max_depth、max_breadth、limit、instructions、chunks_per_source、select_paths、exclude_paths。research() 支持 input、model(mini/pro/auto)、stream、output_schema、citation_format,返回 request_id,需轮询 get_research 直到状态为 completed 或 failed。
详细指南:references/sdk.md 提供 Python 与 JavaScript SDK、异步模式与 Hybrid RAG;references/search.md 讲查询优化与过滤;references/extract.md 讲一步与两步提取;references/crawl.md 讲 crawl 与 map 对比及 Map-then-Extract 模式;references/research.md 讲提示词、模型选择、流式与结构化输出;references/integrations.md 覆盖 LangChain、LlamaIndex、CrewAI、Vercel AI SDK 等集成。
限制:资料未提供具体收费、价格、配额、速率限制与平台支持范围,暂未提供。