From 408acb5540cca7e31dcabe8c59be94ff951bea74 Mon Sep 17 00:00:00 2001 From: JolanThomassin Date: Mon, 15 Jan 2024 15:31:20 +0000 Subject: [PATCH] Fixes #9, magic string --- ailab/db/finesse/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ailab/db/finesse/__init__.py b/ailab/db/finesse/__init__.py index 34777ae..0ce0ca1 100644 --- a/ailab/db/finesse/__init__.py +++ b/ailab/db/finesse/__init__.py @@ -1,6 +1,9 @@ import os import json +# Constants +DEFAULT_JSON_PATH = "/ailab/db/finesse/prompt" + def load_prompt(prompt_path, filename): full_path = os.path.join(prompt_path, filename) @@ -11,7 +14,13 @@ def load_prompt(prompt_path, filename): return content -def load_json_template(json_path): +def load_json_template(json_path=DEFAULT_JSON_PATH): + """ + Load a JSON template from the specified path. + + Returns: + str: A JSON-formatted string representing the loaded data. + """ json_file_path = json_path + "/json_template.json" with open(json_file_path, "r") as file: