From 1574201f71c625871e82b632e854548554a2ddcd Mon Sep 17 00:00:00 2001 From: HanishKVC Date: Sun, 12 May 2024 01:36:03 +0530 Subject: [PATCH] ChatON:LoadJSon:ChatTemplates: revPrompt, system-user flags WIP:NOTE: Initial go converting from json driven flow to ChatTemplatesGroupKV related flow done. Needs to be tested. A optional helper added to load ChatTemplates from a specified json file. Need to add a compile time initialized MapOfMapOfVariants wrt the chat template details of models/standards already known to the program. So that one can use the llama.cpp and this new chat template logic, even without json dependency, if one doesnt want to. --- common/chaton.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/chaton.hpp b/common/chaton.hpp index 4a27d93e8..38df0790e 100644 --- a/common/chaton.hpp +++ b/common/chaton.hpp @@ -361,6 +361,20 @@ inline bool chaton_meta_load(const std::string &fname) { std::string assistantEnd = curTmpl[K_ASSISTANT][K_END]; gCT.set_value(group, { K_ASSISTANT, K_END }, assistantEnd); + + std::string reversePrompt = curTmpl[K_REVERSE_PROMPT]; + gCT.set_value(group, { K_REVERSE_PROMPT }, reversePrompt); + + bool systemHasSuffix = curTmpl[K_SYSTEMUSER_SYSTEM_HAS_SUFFIX]; + gCT.set_value(group, { K_SYSTEMUSER_SYSTEM_HAS_SUFFIX }, systemHasSuffix); + bool systemHasEnd = curTmpl[K_SYSTEMUSER_SYSTEM_HAS_END]; + gCT.set_value(group, { K_SYSTEMUSER_SYSTEM_HAS_END }, systemHasEnd); + + bool userHasBegin = curTmpl[K_SYSTEMUSER_1ST_USER_HAS_BEGIN]; + gCT.set_value(group, { K_SYSTEMUSER_1ST_USER_HAS_BEGIN }, userHasBegin); + bool userHasPrefix = curTmpl[K_SYSTEMUSER_1ST_USER_HAS_PREFIX]; + gCT.set_value(group, { K_SYSTEMUSER_1ST_USER_HAS_PREFIX }, userHasPrefix); + } LOGXLN("%s", gCT.dump("", "DBUG:ChatONMetaLoad:ChatTemplates:").c_str()); return true;