LLM选择调用nonebot插件
Project description
nonebot-plugin-llm-plugins-call
介绍
- 通过LLM结合语境调用已安装的nonebot插件,实现更拟人和自然机器人聊天风格
- 参考LLM中的function_call的实现思路,借助LLM分析用户自然语言和已导入的nonebot插件的metadata,分析自然语言中是否含有插件调用需求,决定是否调用和应该调用哪个插件,根据自然语言构造参数触发对应插件
- 希望能解决的问题:插件装多之后或者某些插件触发命令过于繁琐增加普通用户的使用难度
- 本插件仍在开发测试中,prompt还有很大的优化空间
- 根据语境调用插件的准确性和成功调用受该插件的metadata中的description和usage编写质量影响(详细程度和易于理解度),没有metadata的插件无法通过本插件调用
效果
安装
-
手动安装
git clone https://github.com/Alpaca4610/nonebot_plugin_llm_plugins_call.git下载完成后在bot项目的pyproject.toml文件手动添加插件:
plugin_dirs = ["xxxxxx","xxxxxx",......,"下载完成的插件路径/nonebot-plugin-llm-plugins-call]
配置文件
在Bot根目录下的.env文件中追加如下内容:
必填内容:
plugins_call_key = "" # API的KEY
plugins_call_api_url = "" # LLM的API地址
plugins_call_llm: = "Qwen/QwQ-32B" # 用于选择调用插件的LLM,需要支持tools_call
可选内容(嫌麻烦可以不看):
plugins_call_blacklist = ["nonebot_plugin_xxxx","plugins.xxx"] # 不想使用plugins_call调用的插件黑名单,填入插件模块名,"plugins.xxx"代表手动安装在机器人目录/plugins/xxx目录的插件
使用方法
- @机器人使用
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_plugin_llm_plugins_call-0.0.1.tar.gz.
File metadata
- Download URL: nonebot_plugin_llm_plugins_call-0.0.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.8.0 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03fbf78a629a0f8ddc66c3b1bdc7113193c4db5589f381678803a1304daab5bf
|
|
| MD5 |
9ed97ddefb510ed417f9592427c286e5
|
|
| BLAKE2b-256 |
d1afce9850496e5e860484beeff462b24ad81cdaaa60cffbdeae329f042a3e36
|
File details
Details for the file nonebot_plugin_llm_plugins_call-0.0.1-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_llm_plugins_call-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.8.0 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e94e432004506802ded104109d17cd79e1145c4ed62c502c23802514c340324
|
|
| MD5 |
809a0d5394103b53aef86f71f086054a
|
|
| BLAKE2b-256 |
cef6e5e8e816d029f5126010b2907368aa391f28c0464483d0cbf14e2a7c7c43
|