Skip to content

Commit

Permalink
Fixes #9, magic string
Browse files Browse the repository at this point in the history
  • Loading branch information
JolanThomassin committed Jan 15, 2024
1 parent e9e0533 commit 4f8664d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ailab/db/finesse/__init__.py
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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:
Expand All @@ -20,4 +29,4 @@ def load_json_template(json_path):
# Convert the dictionary back to a JSON-formatted string
content = json.dumps(data, indent=4) # Use 'indent' for pretty printing

return content
return content

0 comments on commit 4f8664d

Please sign in to comment.