zoozl
Server for chatbot services
Usage
For basic example chatbot plugins are provided in zoozl.plugins package. zoozl.plugins.helpers is a simple plugin that greets and helps the user, it is loaded in case no configuration file is provided. zoozl.plugins.bullgame is a plugin that allows to play bulls & cows game.
Installation
pip install zoozl
Optional features (OpenAI embedder, zoozl.agentgear and zoozl.plugins.bullgame) need extra dependencies:
pip install zoozl[extra]
Run websocket server
python -m zoozl --conf chatbot.toml
where chatbot.toml is configuration file.
Architecture
zoozl package contains modules that handle various input interfaces like websocket or http POST and a chatbot interface that must be extended by plugins. Without plugin zoozl is not able to respond to any input. Plugin can be considered as a single chat assistant to handle a specific task. Plugin can be huge and complex or simple and small. It is up to the developer to decide how to structure plugins.
Plugin
Mimimal setup
- Create new toml configuration file (e.g. myconfig.toml)
extensions = ['my_plugin_module']
- Make sure
my_plugin_moduleis importable from within python that will run zoozl server - Create file
my_plugin_module.py
from zoozl.chatbot import Interface
class MyPlugin(Interface):
aliases = ("call myplugin",)
def consume(self, context: , package: Package):
package.callback("Hello this is my plugin response")
- Start zoozl server with your configuration file and asking to bot
call mypluginit will respondHello this is my plugin response
python -m zoozl --conf myconfig.toml
Plugin interface
Plugin must implement consume method that takes two arguments context and package. context is a InterfaceRoot object that contains information about the current chatbot state and package is a Package object that contains input message and callback method to send response back to the user.
Plugin may define aliases attribute that is a tuple of strings that are used to call the plugin. If aliases is not defined, plugin will not be called. Aliases are like commands that user can call to interact with the plugin, however those commands are constructed as embeddings and then compared with input message embeddings to find the best match.
Special aliases are help, cancel and greet. Help alias is used when there is no matching aliases found in plugins, cancel alias is used to cancel current conversation and release it from current plugin handling, greet alias is called immediately before any user message is handled.
If there is only one plugin expected, then aliases most likely should contain all three special aliases, thus plugin will be as soon as connection is made and everytime user asks anything.
Configuration file
Configuration file must conform to TOML format. Example of configuration:
extensions = ["chatbot_fifa_extension", "zoozl.plugins.greeter"]
websocket_port = 80 # if not provided, server will not listen to websocket requests
author = "my_chatbot_name" # defaults to empty string
slack_port = 8080 # if not provided, server will not listen to slack requests
slack_app_token = "xoxb-12333" # Mandatory if slack_port is provided, oAuth token for slack app to send requests to slack
slack_signing_secret = "abc123" # Mandatory if slack_port is provided, secret key to verify requests from slack
email_port = 8081 # if provided, server will listen to LMTP requests there
email_address = "something@localhost" # Mandatory if email_port is provided, email address to send back email messages to
email_smtp_port = 25 # Optional port for sending out email messages to, defaults to 25
whatsapp_port = 8082 # if provided, server will listen to WhatsApp Cloud API webhook requests there
whatsapp_verify_token = "my_verify_token" # Mandatory if whatsapp_port is provided, token for webhook verification
whatsapp_access_token = "EAAG..." # Mandatory if whatsapp_port is provided, Meta Graph API access token
whatsapp_phone_number_id = "123456789" # Mandatory if whatsapp_port is provided, WhatsApp phone number ID
whatsapp_app_secret = "abc123" # Optional, app secret for verifying X-Hub-Signature-256 on inbound requests
[chatbot_fifa_extension] # would be considered as specific configuration for plugin
database_path = "tests/tmp"
administrator = "admin"
Root objects like author, extensions are configuration options for chatbot system wide setup, you can pass unlimited objects in configuration, however suggested is to add a component for each plugin and separate those within components.
- TODO: Describe plugin interface and creation
- TODO: Add authentication and authorization interaction between chatbot and plugin
Metadata
Release files for zoozl 0.3.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 | Actions |
|---|---|---|---|---|
| zoozl-0.3.0.tar.gz | 28.8 kB | Without provenance | Details for zoozl-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zoozl-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for zoozl-0.3.0-py3-none-any.whl |
Total release size: 60.6 kB
Release files / zoozl-0.3.0.tar.gz
| Download URL | zoozl-0.3.0.tar.gz |
|---|---|
| Size | 28.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1aa609dea47bc79b847e322f42c5c5885833e289b950d7c6e8e9cdfbd554745a
|
|
BLAKE2b-256 checksum How to use checksums |
60ab95e21ecac636bdaf649baf143168d5ed5d6d08c60249ee880878b2bc01c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.1
|
Release files / zoozl-0.3.0-py3-none-any.whl
| Download URL | zoozl-0.3.0-py3-none-any.whl |
|---|---|
| Size | 31.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3a9df31565aa3b832318a68ce7c7980cbff430583e86c1b481bae06704c23453
|
|
BLAKE2b-256 checksum How to use checksums |
30621ec95208f3ddbeffb838acb83ab723e635ae0bc080e0fff6e9848a6bdf44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.1
|
Security for zoozl 0.3.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.