mirror of
https://github.com/Paillat-dev/viralfactory.git
synced 2026-01-02 01:06:19 +00:00
Fix dict key
This commit is contained in:
@@ -2,13 +2,16 @@ import yaml
|
|||||||
import os
|
import os
|
||||||
from typing import TypedDict
|
from typing import TypedDict
|
||||||
|
|
||||||
|
|
||||||
class Prompt(TypedDict):
|
class Prompt(TypedDict):
|
||||||
system: str
|
system: str
|
||||||
chat: 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")
|
path = os.path.join(os.getcwd(), location, f"{name}.yaml")
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
raise FileNotFoundError(f"Prompt file {path} does not exist.")
|
raise FileNotFoundError(f"Prompt file {path} does not exist.")
|
||||||
with open(path, "r") as file:
|
with open(path, "r") as file:
|
||||||
return yaml.safe_load(file)
|
prompt: Prompt = yaml.safe_load(file)
|
||||||
|
return prompt["system"], prompt["chat"]
|
||||||
Reference in New Issue
Block a user