nonebot-plugin-tavily
基于 Tavily API 的 NoneBot2 插件,提供强大的实时联网搜索、内容提取和智能抓取能力。
该插件既可以作为普通的 NoneBot 插件独立使用,也可以作为 Tool 供其他 Agent 插件(如 nonebot-plugin-dify)调用。
💿 安装
使用 nb-cli 安装
nb plugin install nonebot-plugin-tavily
使用 pip 安装
pip install nonebot-plugin-tavily
⚙️ 配置
在 .env 文件中添加以下配置:
# Tavily API 密钥 (必填)
TAVILY_API_KEY=tvly-xxxxxxxxxxxxxxxx
# 默认搜索深度: basic (快速) / advanced (深度)
TAVILY_DEFAULT_DEPTH=basic
# 默认最大抓取页面数
TAVILY_MAX_BREADTH=10
# 搜索返回结果数量
TAVILY_MAX_RESULTS=5
# 搜索时间范围: day/week/month/year (留空不限制)
TAVILY_TIME_RANGE=
# 简单模式: 仅输出内容,不含标题和 URL
TAVILY_SIMPLE_MODE=false
# 内容截断长度
TAVILY_SEARCH_TRUNCATE=200 # 搜索结果
TAVILY_EXTRACT_TRUNCATE=2000 # 提取内容
TAVILY_CRAWL_TRUNCATE=150 # 抓取预览
🎉 使用指南
1. 联网搜索 (/search)
获取实时的网络搜索结果。
/search <关键词> [--depth basic|advanced]
示例:
/search "NoneBot2 最新版本" --depth advanced
2. 内容提取 (/extract)
提取指定 URL 的核心正文内容,自动去除广告和无关信息。
/extract <URL> [--depth basic|advanced]
示例:
/extract "https://example.com/article" --depth advanced
3. 智能抓取 (/crawl)
深度抓取网站内容,支持自然语言指令控制抓取目标。
/crawl <URL> [--instructions "指令内容"] [--max_breadth <数量>]
示例:
/crawl "https://company.com" --instructions "查找联系邮箱和地址"
🛠️ 作为工具集成
本插件基于 Alconna 构建,命令参数具有强类型定义,非常适合作为 Agent 工具使用。
如果你使用的是支持工具调用的插件(如 nonebot-plugin-dify),只需将以下命令加入工具白名单即可:
searchextractcrawl
许可证
MIT
Metadata
Release files for nonebot-plugin-tavily 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| nonebot_plugin_tavily-0.1.0.tar.gz | 9.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nonebot_plugin_tavily-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.8 kB
Release files / nonebot_plugin_tavily-0.1.0.tar.gz
| Download URL | nonebot_plugin_tavily-0.1.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f50d99ee8d45357bb5e62836339f9f29d74c732ba3a7a0a0fec3b203a863f8f4
|
|
BLAKE2b-256 checksum How to use checksums |
d1c908619bba8f217d8cd2ad71aed350ba7aee21a5a798058b53488087358ae3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / nonebot_plugin_tavily-0.1.0-py3-none-any.whl
| Download URL | nonebot_plugin_tavily-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d347298af4b5f370a172dd23d82306cab4074031f25772f2a89075d676b76d4
|
|
BLAKE2b-256 checksum How to use checksums |
a429df3b110297dfe7f9ba826b91be7cfd4690402168221c0a8128e99a433451
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for nonebot-plugin-tavily 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.