From dd7479f7869fa00d5d5d96c02f0e1f3dd39b5033 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Sat, 15 Apr 2023 10:19:09 +0200 Subject: [PATCH] Extensions system is being prepared --- docs/Build_extensions.md | 50 ++++++++++++++++++++++++++++++++++++++++ extension.py | 10 ++++++++ 2 files changed, 60 insertions(+) create mode 100644 docs/Build_extensions.md create mode 100644 extension.py diff --git a/docs/Build_extensions.md b/docs/Build_extensions.md new file mode 100644 index 00000000..813c5e76 --- /dev/null +++ b/docs/Build_extensions.md @@ -0,0 +1,50 @@ +# Extension building manual + +## What is an extension +Extensions are little projects built by the community that can be plugged to the generation process to allow users to bring new ideas to the project without feature-creaping it. + +There are many types of extensions: +1 - pipeline extensions +These extensions have no UI, they only intercept the communication between the user and the AI, perform some modifications or operations, then submit them to the discussion to enritch it. For example: +- Net enabled GPT4All (under construction at https://github.com/ParisNeo/Net_enabled-GPT4All-Extension) : An extension that offers a special personality that indicates to the chatbot that whenever the user is asking a question it has no answer to, it should invoke a search function. The extension intercepts this keyword, do the research on the net then mirror it back to the AI. The AI can then use those inputs to formulate an answer. +- Image enabled GPT4All : An extension that uses Blip to convert an image into text that can be interpreted by the AI and used in the discussion. + +The extension should offer a yaml file that describes it to allow the system to integrate it. + +```yaml +# This is a gpt4all extension project +# Project name : Models tester +# Author : ParisNeo +# Description : +# This extension allows applying the model on a bunch of questions at once and recover answers in a text file + +name: GPT4All-Models-Tester-Extension +author: ParisNeo +description: | + This extension allows applying the model on a bunch of questions at once and recover answers in a text file +version: 1.0 + +# UI metadata +has_ui: true + +# backend metadata +can_trigger_the_model : + +# Conditionning override +override_current_personality: true +adds_conditionning: false +conditionning_text: "Respond to my questions." +prefix_text: "Q:" +suffix_text: "A:" + +# Send commands to model +sends_commands_to_model: true + +# Recover model output +uses_model_output : true +recover_word_by_word : false +recover_generated_text : true +``` + +The extension should have a extension.py file on its root that implements Extensions interface: + diff --git a/extension.py b/extension.py new file mode 100644 index 00000000..793b310f --- /dev/null +++ b/extension.py @@ -0,0 +1,10 @@ +# File : extension.py +# Author : ParisNeo +# Description : +# This is the main class to be imported by the extension +# it gives your code access to the model, the callback functions, the model conditionning etc +from config import load_config, save_config + +class Extension(): + def __init__(self, metadata_file_path:str) -> None: + self.config = load_config() \ No newline at end of file