cheshire-cat-ai / core

Production ready AI agent framework
https://cheshirecat.ai
GNU General Public License v3.0
2.25k stars 300 forks source link

Plugin engine/folder structure #107

Closed Mte90 closed 1 year ago

Mte90 commented 1 year ago

I think that the quickstart plugin should be like an example plugin with all the parameters that are hardcoded and is disabled by default (used for testing and for documentation like hello-dolly.php for WordPress). Also there should be a plugin for every service OpenAi etc, so like adds endpoints like https://github.com/pieroit/cheshire-cat/blob/main/web/cat/routes/openapi.py (it should be moved in that plugin).

In my opinion cheshire-cat plugins should be installable with pip (support also a repo so not they aren't mandatory on pypi), in this way they are loaded by the app (django style) and doesn't matter the folder. At same time can be handy to have in my opinion and avoid conflicts with git (also if exist .gitignore) to have a folder with the bundled plugins and one "manual".

Let my explain my hybrid example between Django and WordPress for the plugin system I suggest for this project:

Folder management

So basically I am suggesting a double solution for folders:

With the second solution can experiment but with the first one open the doors to more interesting options.

Plugin engine

So next step is to define how to interface with plugins.
Laravel and Django works that you extend the native classes but this doesn't let you to mix so much multiple classes and is not easy for newcomers/newbie of development.
Another approach is the one by WordPress based on hooks where you can specify callbacks on some keys and the CMS (in that case) check if there is something registered. In this way you can create a queue of code to be executed between various sources. Yes, Laravel offers signals and also Django that are similar but they are forced to a specific set of events on some defined behavior. In our case we want to be more elastic.

Plugin user cases examples

This user cases are just example to provide some ideas where in the actua lcode can be interesting to put something that let's the user to extend the behavior.

Resources

PS: moved from #63

pieroit commented 1 year ago

I need time to reply to this. Coming back asap

pieroit commented 1 year ago

Plugins are being discussed in other issues, closing this as it has been useful but now too general