Spaces:
Sleeping
Sleeping
import datetime | |
from pathlib import Path | |
from utils.date_utils import get_today_date_as_dd_mm_yyyy | |
from form.form import work_categories as wc | |
class PromptsManager: | |
def __init__(self, work_categories: dict[str, str] = None): | |
if not work_categories: | |
self.work_categories = wc | |
base_path = Path(__file__, "..") | |
with open(Path(base_path, "system_prompt.txt")) as sysprompt_file: | |
self.system_prompt: str = sysprompt_file.read() | |
with open(Path(base_path, "questions.txt")) as questions_file: | |
self.questions: list[str] = questions_file.readlines() | |
with open(Path(base_path, "verification_prompt2.txt")) as verification_prompt_file: | |
verification_prompt = verification_prompt_file.read() | |
todays_date = get_today_date_as_dd_mm_yyyy() | |
verification_prompt = verification_prompt.replace("{today}", todays_date) | |
self.verification_prompt: str = verification_prompt | |
def verify_user_input_prompt(self, user_prompt) -> str: | |
return (f"Using only this information \n {user_prompt} \n answer the following questions, if the answer is not present or you are not sure about the answer just answer null. " | |
f"Put each answer in a new line, keep the answer brief " | |
f"and maintain the order in which the questions are asked. Do not add any preamble: " | |
f"{self.verification_prompt}") | |
def get_work_category(self, work_description: str) -> str: | |
return (f"The work to do is {work_description}. Given the following categories {", ".join(self.work_categories.values())} " | |
f"which ones are the most relevant? Only return the categories, separated by a semicolon") | |
def ingest_user_answers(self, user_prompt: str) -> str: | |
return f"Ingest the following information: {user_prompt}" | |