From e3deafbf75c3440fba456b4255edd833e2b3efbb Mon Sep 17 00:00:00 2001 From: Paillat Date: Thu, 15 Feb 2024 17:54:21 +0100 Subject: [PATCH] Fix dict key --- src/utils/prompting.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/prompting.py b/src/utils/prompting.py index 90facc6..5bcd774 100644 --- a/src/utils/prompting.py +++ b/src/utils/prompting.py @@ -2,13 +2,16 @@ import yaml import os from typing import TypedDict + class Prompt(TypedDict): system: str chat: str -def get_prompt(name, *, location = "src/chore/prompts") -> Prompt: + +def get_prompt(name, *, location="src/chore/prompts") -> tuple[str, str]: path = os.path.join(os.getcwd(), location, f"{name}.yaml") if not os.path.exists(path): raise FileNotFoundError(f"Prompt file {path} does not exist.") with open(path, "r") as file: - return yaml.safe_load(file) \ No newline at end of file + prompt: Prompt = yaml.safe_load(file) + return prompt["system"], prompt["chat"] \ No newline at end of file