File size: 770 Bytes
0b41e08
 
 
 
7a8e8f9
7c14819
0b41e08
 
7c14819
0b41e08
4e76117
0b41e08
4e76117
 
 
 
 
0b41e08
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
from pathlib import Path
from yaml import safe_load

DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
OPENROUTER_API_KEY = os.environ.get("OPENROUTER_API_KEY")
HF_TOKEN = os.environ.get("HF_TOKEN")
GROQ_API_KEY = os.environ.get("GROQ_API_KEY")
GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY") 


CURRENT_DIR = Path(__file__).parent
# Try both extensions
_prompts_path = CURRENT_DIR.joinpath("prompts.yaml")
if not _prompts_path.exists():
    _prompts_path = CURRENT_DIR.joinpath("prompts.yml")
_PROMPTS = safe_load(_prompts_path.read_text(encoding="utf-8"))


def get_prompt(prompt_key: str, **kwargs: str) -> str:
    """Get a prompt by key and fill in placeholders via `.format(**kwargs)`"""
    return _PROMPTS[prompt_key].format(**kwargs)