From d8c842263f0be02681e5c9ed756c07033f03f0bd Mon Sep 17 00:00:00 2001 From: Jared Van Bortel Date: Wed, 6 Mar 2024 14:22:08 -0500 Subject: [PATCH] python: more fixes for new prompt templates (#2044) Signed-off-by: Jared Van Bortel --- gpt4all-bindings/python/gpt4all/gpt4all.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gpt4all-bindings/python/gpt4all/gpt4all.py b/gpt4all-bindings/python/gpt4all/gpt4all.py index e8a855d6..ee8ff3fd 100644 --- a/gpt4all-bindings/python/gpt4all/gpt4all.py +++ b/gpt4all-bindings/python/gpt4all/gpt4all.py @@ -158,9 +158,8 @@ class GPT4All: if model_filename == m["filename"]: config.update(m) config["systemPrompt"] = config["systemPrompt"].strip() - config["promptTemplate"] = config["promptTemplate"].replace( - "%1", "{0}", 1 - ) # change to Python-style formatting + # change to Python-style formatting + config["promptTemplate"] = config["promptTemplate"].replace("%1", "{0}", 1).replace("%2", "{1}", 1) break # Validate download directory @@ -347,7 +346,7 @@ class GPT4All: self.model.prompt_model(self.current_chat_session[0]["content"], "%1", _pyllmodel.empty_response_callback, n_batch=n_batch, n_predict=0, special=True) - prompt_template = self._current_prompt_template.format("%1") + prompt_template = self._current_prompt_template.format("%1", "%2") else: warnings.warn( "_format_chat_prompt_template is deprecated. Please use a chat session with a prompt template.",