Spaces:
Sleeping
Sleeping
File size: 486 Bytes
ec04e37 8750d52 76b50fb 8750d52 76b50fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import os
def load_prompt(filename):
"""Reads a prompt file from src/prompts."""
current_dir = os.path.dirname(__file__)
prompts_dir = os.path.join(os.path.dirname(current_dir), 'prompts')
file_path = os.path.join(prompts_dir, filename)
try:
with open(file_path, 'r', encoding='utf-8') as f:
return f.read()
except FileNotFoundError:
# Fallback if file is missing
return f"You are a helpful assistant. Task: {filename}"
|