File size: 910 Bytes
fdfe81a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""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"


@lru_cache(maxsize=8)
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")