From c746a5bd00c39776bec0091a570f3348aa785caa Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Fri, 12 May 2023 14:40:48 -0300 Subject: [PATCH] Add .rstrip(' ') to openai api --- extensions/openai/script.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/openai/script.py b/extensions/openai/script.py index 5c62ceb2..95fe181c 100644 --- a/extensions/openai/script.py +++ b/extensions/openai/script.py @@ -70,7 +70,7 @@ def deduce_template(): .replace('<|user|>', instruct.get('user', ''))\ .replace('<|bot|>', instruct.get('bot', ''))\ .replace('<|user-message|>', '{instruction}\n{input}') - return instruct.get('context', '') + template[:template.find('<|bot-message|>')] + return instruct.get('context', '') + template[:template.find('<|bot-message|>')].rstrip(' ') except: return default_template