Files
Auto-GPT/scripts/data.py
Pavloh 8150f0c813 Refactor load_prompt function
Simplify the load_prompt function by eliminating redundancy
2023-04-04 13:24:14 +02:00

18 lines
485 B
Python

import os
from pathlib import Path
def load_prompt():
try:
# get directory of this file:
file_dir = Path(__file__).parent
prompt_file_path = file_dir / "data" / "prompt.txt"
# Load the prompt from data/prompt.txt
with open(prompt_file_path, "r") as prompt_file:
prompt = prompt_file.read()
return prompt
except FileNotFoundError:
print("Error: Prompt file not found", flush=True)
return ""