From 56762bbfd91f67c1d2c1560e3ae2f41c322dcea2 Mon Sep 17 00:00:00 2001 From: saloui Date: Thu, 6 Jul 2023 14:58:29 +0200 Subject: [PATCH 1/2] added GenerationPresets --- lollms/types.py | 26 ++++++++++++++++++++++++++ setup.py | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lollms/types.py b/lollms/types.py index a0b6690..f0baa1c 100644 --- a/lollms/types.py +++ b/lollms/types.py @@ -21,3 +21,29 @@ class MSG_TYPE(Enum): MSG_TYPE_REF=10 # References (in form of [text](path)) MSG_TYPE_CODE=11 # A javascript code to execute MSG_TYPE_UI=12 # A vue.js component to show (we need to build some and parse the text to show it) + +class GenerationPresets: + """ + Class containing various generation presets. + """ + + @staticmethod + def deterministic_preset(): + """ + Preset for deterministic output with low temperature and top_k, and high top_p. + """ + return {'temperature': 0.2, 'top_k': 10, 'top_p': 0.8} + + @staticmethod + def creative_preset(): + """ + Preset for creative output with high temperature, top_k, and top_p. + """ + return {'temperature': 0.8, 'top_k': 50, 'top_p': 0.9} + + @staticmethod + def default_preset(): + """ + Default preset with moderate temperature, top_k, and top_p. + """ + return {'temperature': 0.5, 'top_k': 20, 'top_p': 0.85} \ No newline at end of file diff --git a/setup.py b/setup.py index 2ac1bcc..320955a 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def get_all_files(path): setuptools.setup( name="lollms", - version="2.1.28", + version="2.1.29", author="Saifeddine ALOUI", author_email="aloui.saifeddine@gmail.com", description="A python library for AI personality definition", From e91fbe0a25d08b4ff06f1cdcea9a6774d674f1f5 Mon Sep 17 00:00:00 2001 From: saloui Date: Thu, 6 Jul 2023 21:14:47 +0200 Subject: [PATCH 2/2] upgraded --- lollms/personality.py | 21 +++++++++++++++++++++ lollms/types.py | 29 ++++++++++++++++------------- setup.py | 2 +- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/lollms/personality.py b/lollms/personality.py index d9951a8..839629a 100644 --- a/lollms/personality.py +++ b/lollms/personality.py @@ -1098,6 +1098,27 @@ class APScript: if callback: callback(full_text, MSG_TYPE.MSG_TYPE_FULL) + def full_invisible_to_ai(self, full_text:str, callback=None): + """This sends full text to front end (INVISIBLE to AI) + + Args: + step_text (dict): The step text + callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the text to. Defaults to None. + """ + if callback: + callback(full_text, MSG_TYPE.MSG_TYPE_FULL_INVISIBLE_TO_AI) + + def full_invisible_to_user(self, full_text:str, callback=None): + """This sends full text to front end (INVISIBLE to user) + + Args: + step_text (dict): The step text + callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the text to. Defaults to None. + """ + if callback: + callback(full_text, MSG_TYPE.MSG_TYPE_FULL_INVISIBLE_TO_USER) + + def info(self, info_text:str, callback=None): """This sends info text to front end diff --git a/lollms/types.py b/lollms/types.py index f0baa1c..b629ad7 100644 --- a/lollms/types.py +++ b/lollms/types.py @@ -2,25 +2,28 @@ from enum import Enum class MSG_TYPE(Enum): # Messaging - MSG_TYPE_CHUNK=0 # A chunk of a message (used for classical chat) - MSG_TYPE_FULL=1 # A full message (for some personality the answer is sent in bulk) + MSG_TYPE_CHUNK = 0 # A chunk of a message (used for classical chat) + MSG_TYPE_FULL = 1 # A full message (for some personality the answer is sent in bulk) + MSG_TYPE_FULL_INVISIBLE_TO_AI = 2 # A full message (for some personality the answer is sent in bulk) + MSG_TYPE_FULL_INVISIBLE_TO_USER = 3 # A full message (for some personality the answer is sent in bulk) + # Conditionning # Informations - MSG_TYPE_EXCEPTION=2 # An exception occured - MSG_TYPE_WARNING=3 # A warning occured - MSG_TYPE_INFO=4 # An information to be shown to user + MSG_TYPE_EXCEPTION = 4 # An exception occured + MSG_TYPE_WARNING = 5 # A warning occured + MSG_TYPE_INFO = 6 # An information to be shown to user # Steps - MSG_TYPE_STEP=5 # An instant step (a step that doesn't need time to be executed) - MSG_TYPE_STEP_START=6 # A step has started (the text contains an explanation of the step done by he personality) - MSG_TYPE_STEP_PROGRESS=7 # The progress value (the text contains a percentage and can be parsed by the reception) - MSG_TYPE_STEP_END=8 # A step has been done (the text contains an explanation of the step done by he personality) + MSG_TYPE_STEP = 7 # An instant step (a step that doesn't need time to be executed) + MSG_TYPE_STEP_START = 8 # A step has started (the text contains an explanation of the step done by he personality) + MSG_TYPE_STEP_PROGRESS = 9 # The progress value (the text contains a percentage and can be parsed by the reception) + MSG_TYPE_STEP_END = 10# A step has been done (the text contains an explanation of the step done by he personality) #Extra - MSG_TYPE_JSON_INFOS=9 # A JSON output that is useful for summarizing the process of generation used by personalities like chain of thoughts and tree of thooughts - MSG_TYPE_REF=10 # References (in form of [text](path)) - MSG_TYPE_CODE=11 # A javascript code to execute - MSG_TYPE_UI=12 # A vue.js component to show (we need to build some and parse the text to show it) + MSG_TYPE_JSON_INFOS = 11# A JSON output that is useful for summarizing the process of generation used by personalities like chain of thoughts and tree of thooughts + MSG_TYPE_REF = 12# References (in form of [text](path)) + MSG_TYPE_CODE = 13# A javascript code to execute + MSG_TYPE_UI = 14# A vue.js component to show (we need to build some and parse the text to show it) class GenerationPresets: """ diff --git a/setup.py b/setup.py index 320955a..0f20a59 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def get_all_files(path): setuptools.setup( name="lollms", - version="2.1.29", + version="2.1.31", author="Saifeddine ALOUI", author_email="aloui.saifeddine@gmail.com", description="A python library for AI personality definition",