Skip to main content

A Agent shceduling nonebot2 plugin via user natural language inpput

Project description

nonebot-plugin-agent

此插件可帮助用户编写 Agent 插件或集成他人编写的插件,并添加至 Agent 中,帮助用户使用自然语言与你的插件生态进行交互

测试阶段目前支持私聊以及 @ 触发,请妥善管理好调用频率,以防你所使用的 LLM 服务商账户超消。后续集成用户黑白名单

Agent 默认不集成任何插件,安装支持 Agent 的插件的方式与普通插件一致。

如果你想自己编写插件,请调用 Tool.add_to_tool_list 函数。编写一个 Agent 插件的代码如下

from nonebot import require
require("nonebot_plugin_agent")
from nonebot_plugin_agent.llm import Tool

def funcx(account: str, password: str) -> str:
    return str(len(account) + len(password))


Tool.add_to_tool_list(
    funcx,
    {
        "account": {"type": "string", "description": "user's steam account"},
        "password": {"type": "string", "description": "user's steam password"}
    },
    "this function helps user calculating their amount of games in steam library, needing account and password of steam"
)

其中:

  • 第一个参数为一个 Callable 对象,支持异步与同步调用,返回值必须为一个 str 对象
  • 第二个参数为该 Callable 对象的形参参数 Schema,此处使用 Json Schema 格式
  • 第三个参数为该插件的介绍,用于帮助 LLM 更好的识别你的插件的用途

当你完成上述操作之后,便可以直接启动 Bot,此时插件已经注册到 Agent 中等待调用。

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

nonebot_plugin_agent-0.0.1.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

nonebot_plugin_agent-0.0.1-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_agent-0.0.1.tar.gz.

File metadata

  • Download URL: nonebot_plugin_agent-0.0.1.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.13 Darwin/22.4.0

File hashes

Hashes for nonebot_plugin_agent-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d6d1d284df476be804ec99d1491b726f4085c81ecbd7bcb54817d5ffc8a83a3b
MD5 adaa43ddd6c580df5e5c018cf65c79d9
BLAKE2b-256 f215e13421405791708ded03159c5467611f2091b8e09ebea3567c1dd3d0150a

See more details on using hashes here.

File details

Details for the file nonebot_plugin_agent-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_agent-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 102d88ca8387385c14010ba6ac48d16808594eef0f697f743e8d7e1148cb634f
MD5 f408da4b70090569020529584356d5be
BLAKE2b-256 5f39ad061c020a8f7821b9a5852cc23ecf47819dfb3ef9eca35e83d504855f7e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page