File size: 996 Bytes
7344bef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
from __future__ import annotations

from pathlib import Path

from . import debug_bootstrap as _debug_bootstrap


_debug_bootstrap.bootstrap_deepy_debug()


_DEEPY_DIR = Path(__file__).resolve().parent
DEFAULT_SYSTEM_PROMPT_PATH = _DEEPY_DIR / "default_system_prompt.txt"


def load_default_system_prompt() -> str:
    try:
        return DEFAULT_SYSTEM_PROMPT_PATH.read_text(encoding="utf-8").strip()
    except FileNotFoundError as exc:
        raise FileNotFoundError(f"Deepy default system prompt file not found: {DEFAULT_SYSTEM_PROMPT_PATH}") from exc


DEFAULT_SYSTEM_PROMPT = load_default_system_prompt()


def __getattr__(name: str):
    if name in {"DEBUG_DEEPY_ENABLED", "DEBUG_DEEPY_LOG_PATH"}:
        return getattr(_debug_bootstrap, name)
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


__all__ = [
    "DEBUG_DEEPY_ENABLED",
    "DEBUG_DEEPY_LOG_PATH",
    "DEFAULT_SYSTEM_PROMPT",
    "DEFAULT_SYSTEM_PROMPT_PATH",
    "load_default_system_prompt",
]