-
Notifications
You must be signed in to change notification settings - Fork 646
Expand file tree
/
Copy pathconstants.py
More file actions
105 lines (93 loc) 路 3.29 KB
/
Copy pathconstants.py
File metadata and controls
105 lines (93 loc) 路 3.29 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
"""Centralized constants for the minimal agent production example.
This module exposes a flat set of constants and exactly two environment-
based overrides for ease of configuration without expanding the surface
area of runtime knobs.
Only the following environment variables are read:
- DOC_ANALYSIS_LLM_MODEL
- DOCUMENT_ANALYSIS_ENDPOINT
"""
import os
# -----------------------------------------------------------------------------
# Allowed environment-based overrides (only these read from env)
# -----------------------------------------------------------------------------
DOC_ANALYSIS_LLM_MODEL: str = os.getenv("DOC_ANALYSIS_LLM_MODEL", "gpt-5-mini")
DOCUMENT_ANALYSIS_ENDPOINT: str = os.getenv(
"DOCUMENT_ANALYSIS_ENDPOINT", "http://localhost:8000"
)
# Optional convenience alias for UI display consistency
LLM_MODEL: str = DOC_ANALYSIS_LLM_MODEL
# -----------------------------------------------------------------------------
# LLM defaults (literals only)
# -----------------------------------------------------------------------------
LLM_TEMPERATURE: float = 0.1
LLM_MAX_TOKENS: int = 300
MODEL_LABEL_FMT: str = "openai-{model} (llm)"
# -----------------------------------------------------------------------------
# Ingestion defaults (literals only)
# -----------------------------------------------------------------------------
URL_TIMEOUT_S: int = 30
DEFAULT_DOC_TYPE: str = "text"
EXTENSION_TO_TYPE: dict[str, str] = {
"md": "markdown",
"txt": "text",
"py": "text",
"js": "text",
"html": "text",
"xml": "text",
"csv": "text",
"json": "text",
}
# -----------------------------------------------------------------------------
# UI defaults (literals only)
# -----------------------------------------------------------------------------
REQUEST_TIMEOUT_S: int = 120
INVOKE_SUFFIX: str = "/invoke"
UI_PREVIEW_MAX_CHARS: int = 1000
READABILITY_EASY_GT: float = 0.7
READABILITY_MEDIUM_GT: float = 0.4
SENTIMENT_EMOJI: dict[str, str] = {
"positive": "馃槉",
"negative": "馃槥",
"neutral": "馃槓",
}
UPLOAD_FILE_TYPES: list[str] = [
"txt",
"md",
"csv",
"json",
"py",
"js",
"html",
"xml",
]
# -----------------------------------------------------------------------------
# Rendering constants (literals only)
# -----------------------------------------------------------------------------
TEMPLATE_CSS_FILENAME: str = "report.css"
TEMPLATE_HTML_FILENAME: str = "report.html"
SENTIMENT_COLORS: dict[str, str] = {
"positive": "#10b981", # green
"negative": "#ef4444", # red
"neutral": "#6b7280", # gray
}
# Preferred key for method labels
METHOD_LABELS: dict[str, str] = {
"llm": "馃 AI-Powered",
"deterministic": "馃敡 Rule-Based",
"deterministic_fallback": "馃敡 Rule-Based (Fallback)",
}
# Backwards-compatible alias (used by render.py)
METHOD_DISPLAY_MAP: dict[str, str] = METHOD_LABELS
# -----------------------------------------------------------------------------
# Text heuristics (literals only)
# -----------------------------------------------------------------------------
KEYWORD_COUNT: int = 5
CONTENT_PREVIEW_CHARS: int = 2000
READABILITY_SCORE_MAP: dict[str, float] = {
"easy": 0.9,
"medium": 0.6,
"hard": 0.3,
}
MIN_MEANINGFUL_PARAGRAPH_LEN: int = 50
MAX_SUMMARY_CHARS: int = 200
MAX_SUMMARY_SENTENCES: int = 3