Spaces:
Sleeping
Sleeping
Download agents/_prompt_loader.py from DerXanity/farient-deckcheck: direct link, hf CLI and curl.
- Browser
- Download file 910 Bytes
-
https://huggingface.co/spaces/DerXanity/farient-deckcheck/resolve/main/agents/_prompt_loader.py
- Command line
-
hf download hf://spaces/DerXanity/farient-deckcheck/agents/_prompt_loader.py
-
curl -L -o _prompt_loader.py https://huggingface.co/spaces/DerXanity/farient-deckcheck/resolve/main/agents/_prompt_loader.py
910 Bytes
| """Helpers to load system prompts from agents/prompts/*.md. | |
| Prompts are stored as Markdown files so they can be edited without code | |
| changes. They are read once at module-load time (cached at import scope) and | |
| returned as plain strings to the Agents SDK ``instructions=...`` parameter. | |
| """ | |
| from __future__ import annotations | |
| from functools import lru_cache | |
| from pathlib import Path | |
| _PROMPTS_DIR = Path(__file__).parent / "prompts" | |
| def load_prompt(name: str) -> str: | |
| """Load ``agents/prompts/<name>.md`` and return its text. | |
| Parameters | |
| ---------- | |
| name: | |
| Stem of the prompt file (no ``.md`` suffix). Examples: | |
| ``"slide_reviewer"``, ``"consistency"``, ``"lead_auditor"``. | |
| """ | |
| path = _PROMPTS_DIR / f"{name}.md" | |
| if not path.exists(): | |
| raise FileNotFoundError(f"Prompt file not found: {path}") | |
| return path.read_text(encoding="utf-8") | |