From a81bbb85bfef0ca687c46c9bdcb12a0320cdf3c5 Mon Sep 17 00:00:00 2001 From: hailsham Date: Thu, 19 Sep 2024 18:12:04 +0800 Subject: [PATCH] [FIX] Added handling for the "begin section" in meta_template to APITemplateParser (#1405) Co-authored-by: leifei --- opencompass/models/base_api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opencompass/models/base_api.py b/opencompass/models/base_api.py index c88aa154c..655f7d6e1 100644 --- a/opencompass/models/base_api.py +++ b/opencompass/models/base_api.py @@ -281,6 +281,9 @@ def parse_template(self, prompt_template: PromptType, new_prompt.append(item) prompt = new_prompt + if self.meta_template.get('begin', None): + prompt.insert(0, self.meta_template['begin']) + else: # in case the model does not have any meta template prompt = ''