Skip to main content

NoneBot-Plugin-LLM-Extension

✨ 将自然语言转换为机器人指令 ✨

pypi python uv-managed alc-resolved
NoneBot Registry Supported Adapters
📸 演示与预览   |   📦️ 下载插件   |   💬 加入交流群

📖 介绍 Human coded

利用 LLM 将自然语言转换为机器人指令 / Convert natural language messages into bot commands using LLMs

[!IMPORTANT] 收藏项目,你将从 GitHub 上无延迟地接收所有发布通知~⭐️

starify

💿 安装

以下提到的方法任选 其一 即可

[推荐] 使用 nb-cli 安装 在 Bot 的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-llm-extension
使用包管理器安装
pip install nonebot-plugin-llm-extension
# or, use poetry
poetry add nonebot-plugin-llm-extension
# or, use pdm
pdm add nonebot-plugin-llm-extension
# or, use uv
uv add nonebot-plugin-llm-extension

⚙️ 配置

在项目的配置文件中添加下表中配置:

其实这里并不建议使用 deepseek

配置项 默认值 说明
llm_extension__api_key 无 API 密钥
llm_extension__base_url https://api.deepseek.com/v1 API 端点
llm_extension__model deepseek-reasoner 模型名

🎉 使用

[!NOTE] 为了使 LLM 能够更好地理解和转换用户输入为指令,建议在构造指令时:

  1. 完善命令描述:为每个命令提供清晰、准确的描述信息
  2. 丰富参数说明:详细说明每个参数的含义、类型和取值范围
  3. 提供使用示例:给出具体的操作示例,帮助 LLM 理解命令的使用场景
from nonebot_plugin_llm_extension import LLMExtension
from nonebot_plugin_alconna import on_alconna, Args, Alconna, CommandMeta

weather = on_alconna(
    Alconna(
      "weather",
      Args["location?#地区", str],
      meta=CommandMeta(
        description="今日天气",
        example="/天气 陕西汉中"
      )
    ), 
    use_cmd_start=True,
    extension=[LLMExtension],
)

通过提供完善的命令元信息,可以让 LLM 更准确地理解命令意图,从而提高自然语言到指令的转换准确率

📸 效果图

理论上,这里应该有一张图片

💖 鸣谢

📄 许可证

本项目使用 MIT 许可证开源

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Metadata

Release files for nonebot-plugin-llm-extension 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-plugin-llm-extension 0.1.1
File Size Uploaded
nonebot_plugin_llm_extension-0.1.1.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-llm-extension 0.1.1
File Interpreter ABI Platform
nonebot_plugin_llm_extension-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.8 kB

Release files / nonebot_plugin_llm_extension-0.1.1.tar.gz

Download URL nonebot_plugin_llm_extension-0.1.1.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0e98e983c5d7f27aa4c20fea5f741e4262efd09a463a6b4921948584283a5bef
BLAKE2b-256 checksum
How to use checksums
2e4f8b93ca653eb9aee60356399701fdf0ab1daceac4b737f1f96941935a6f7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.22

Release files / nonebot_plugin_llm_extension-0.1.1-py3-none-any.whl

Download URL nonebot_plugin_llm_extension-0.1.1-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf80d9ac5a4f971f66e9679fa591417b7a342566f73390cc2b7f633a90d7dc81
BLAKE2b-256 checksum
How to use checksums
5eb0cb244d12507525de56bd79f2223ae1546d663094aa4e46012c63b698b94a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.22

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page