From d28b86294d40af9a504f5d2d89c92c576937993b Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Sun, 16 Apr 2023 14:06:22 +0200 Subject: [PATCH] koboldai-style prompt --- matrix_pygmalion_bot/ai/model_helpers.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/matrix_pygmalion_bot/ai/model_helpers.py b/matrix_pygmalion_bot/ai/model_helpers.py index 31481c2..b7fc55c 100644 --- a/matrix_pygmalion_bot/ai/model_helpers.py +++ b/matrix_pygmalion_bot/ai/model_helpers.py @@ -45,6 +45,9 @@ async def get_full_prompt(simple_prompt: str, bot, chat_history, model_name: str elif model_name.startswith("alpaca"): ai_name = bot.name # ToDo user_name = bot.user_name # ToDo + elif mode_name.startswith("koboldai"): + ai_name = bot.name + user_name = "You" else: ai_name = bot.name user_name = bot.user_name @@ -66,6 +69,8 @@ async def get_full_prompt(simple_prompt: str, bot, chat_history, model_name: str prompt += f"NSFW content allowed.\n" # ToDo prompt += f"\n" prompt += "### Input:\n" + elif mode_name.startswith("koboldai"): + prompt = "" else: prompt = "" @@ -76,6 +81,8 @@ async def get_full_prompt(simple_prompt: str, bot, chat_history, model_name: str prompt += bot.name + "'s Persona: " + bot.get_persona() + "\n" # ToDo elif model_name.startswith("alpaca"): prompt += bot.name + "'s Persona: " + bot.get_persona() + "\n" # ToDo + elif mode_name.startswith("koboldai"): + prompt = f"[Character: {bot.get_persona()}]\n" else: prompt += bot.name + "'s Persona: " + bot.get_persona() + "\n" # ToDo @@ -86,6 +93,8 @@ async def get_full_prompt(simple_prompt: str, bot, chat_history, model_name: str prompt += "Scenario: " + bot.get_scenario() + "\n\n" # ToDo elif model_name.startswith("alpaca"): prompt += "Scenario: " + bot.get_scenario() + "\n\n" # ToDo + elif mode_name.startswith("koboldai"): + prompt = f"[Start Scene: {bot.get_scenario()}]\n\n" else: prompt += "Scenario: " + bot.get_scenario() + "\n\n" # ToDo @@ -96,6 +105,8 @@ async def get_full_prompt(simple_prompt: str, bot, chat_history, model_name: str prompt += "### Response:\n" # ToDo elif model_name.startswith("alpaca"): prompt += "### Response:\n" + elif mode_name.startswith("koboldai"): + pass else: pass @@ -114,6 +125,8 @@ async def get_full_prompt(simple_prompt: str, bot, chat_history, model_name: str pass # ToDo elif model_name.startswith("alpaca"): pass # ToDo + elif mode_name.startswith("koboldai"): + pass else: pass # ToDo