KKallas / Marvin

Discord bot for use in Automated ERP and manufacturing workflows
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Structure of the bot #9

Open KKallas opened 1 year ago

KKallas commented 1 year ago

Software structure

Marvin is minimal logic base to provide UI to different AI helpers with discordpy framework Context for Marvin: If the user is asking information or functionality please see if some of the plugins you have in builtin_plugins list suit the the task, if so can you give the description how to run the plugin with explanations of the parameters You used.

All The user specific functionality split into two categories (or directories respectively):

Plugin

Python file containing special header: Name, Description (up to 6 sentences), When to use (up to 6 sentences), parameters with descriptions.

When plugin is installed we ask the 1st AI assistant to create python logic to select plugin to answer next query. Every time we install a plugin we update the python logic, or have manual override.

Sample plugin: odooproductList : when user requires to confirm that specific product is part of company inventory and or requires technical information about the product. Anything from Research and development to manufacturing and social media posts are available through odoo plugins

Command

Command are functionality that AI cannot/should not handle directly. These are either input/output (other servers, readers, cameras, printers etc) or specific repeatable tasks (winmacro, jupyterlab auto). Commands can be created with help of the same assistants that already are implemented either with boiler plating or debugging.

Sample Commands ['read', 'edit', 'write', 'run'] /read filename.py will give me Jupyter Lab link /edit filename.py --start 0:4 --text "text to be written" will change the filename.py and reload the plugins to load the change Marvin can you open the plugin named odoo_test and change the odoo server to myserver.odoo.com /write needs an attachment, the file checked and written, plugins reloaded /run filename.py params_str output answer as code replied as answer

KKallas commented 1 year ago

Object structure

Bot Object:

The central component that represents the Discord bot itself. It manages the connection to the Discord server, handles events, and coordinates the interactions between other components.

Commands Object:

Responsible for handling / commands received in the Discord chat. It executes Python code, saves Python files, and reads Python files based on the provided commands. Manages the local context, so if python object within same thread is persistent.

ConversationManager Object:

Manages conversations in the Discord chat. It detects messages ending with @username and a question mark, creates new threads if needed, and forwards them to the AI engine for answering. The conversation object should be optimized to support simple to implement customizations for different large model conversation models like open AI or oogabooga websocket API

Output Object

To handle, thread creation or answers, formatting and if necessary splitting the answers to multiple posts due to the 2K character limitation

PythonPlugin Object:

Acts as a plugin for the user to run peripherals or specific software available only to the bot. Interface, Function, and parameters if applicable

Configuration Object:

Manages the configuration options for the bot. It includes settings like the identity string used as context for the AI engine and other customizable parameters, like AI engine and setup-script to autorun some PythonPlugins Object when the bot is created.

PluginManager Object:

Handles the loading and management of of plugins. When system is started the configuration object will define Plugins list be loaded. If user adds a plugin and runs it, it should be listed and manageable from here

KKallas commented 1 year ago

So after little bit of research it seems that Diascopy has this plugin structure already build, so making this project pf of boilerplate code for discord to make locally runnable python bot assistant that can use large language model for interaction and python with 3drd party software running local computer to preform various industrial tasks.

So Cog's all they way I guess