Ghisalbertifederico's picture
Update config.py
4e76117 verified
raw
history blame contribute delete
770 Bytes
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)