in src/models/struxgpt_base.py [0:0]
def load_prompt_template(self):
template = load_file(self.prompt_template_path)
## compatible for string-format and JSON-format in prompt template
json_fomatter = re.findall('```json\n([^`]*)\n```', template)
json_mapping = {k: f'##JSON{i}' for i, k in enumerate(json_fomatter)}
for src, dst in json_mapping.items():
template = template.replace(src, dst)
self.prompt_template = template
self.json_mapping = json_mapping
self.prompt_system = load_file(self.prompt_system_path)