Files
Auto-GPT/scripts/data.py
Andres Caicedo 1632f7ebf6 Update data.py
Just import path from OS library.
2023-04-04 11:30:20 +02:00

20 lines
573 B
Python

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