-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig_loader.py
More file actions
118 lines (69 loc) · 2.67 KB
/
Copy pathconfig_loader.py
File metadata and controls
118 lines (69 loc) · 2.67 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
106
107
108
109
110
111
112
113
114
115
116
117
118
"""
Config Loader — Reads config.yaml and provides business configuration to all modules.
"""
import os
import yaml
_config = None
def get_config():
"""Load and cache config.yaml."""
global _config
if _config is None:
config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.yaml")
with open(config_path, encoding="utf-8") as f:
_config = yaml.safe_load(f)
return _config
def get_business():
"""Get business section of config."""
return get_config().get("business", {})
def get_agent_config():
"""Get agent section of config."""
return get_config().get("agent", {})
def get_product_config():
"""Get product section of config."""
return get_config().get("product", {})
def get_frontend_config():
"""Get frontend section of config."""
return get_config().get("frontend", {})
def get_deployment_config():
"""Get deployment section of config."""
return get_config().get("deployment", {})
def get_model_config():
"""Get model generation config (temperature, max_output_tokens, etc.)."""
return get_agent_config().get("model_config", {})
def get_thinking_config():
"""Get thinking/planner config (enabled, thinking_budget, etc.)."""
return get_agent_config().get("thinking", {})
# Convenience accessors
def business_name():
return get_business().get("name", "My Business")
def business_address():
return get_business().get("address", "")
def business_phone():
return get_business().get("phone", "")
def business_email():
return get_business().get("email", "")
def business_street():
return get_business().get("street", "")
def business_city():
return get_business().get("city", "")
def business_state():
return get_business().get("state", "")
def business_zip():
return get_business().get("zip", "")
def business_city_state_zip():
"""'Huffman, TX 77336' — built from the structured config components."""
region = " ".join(p for p in (business_state(), business_zip()) if p)
return ", ".join(p for p in (business_city(), region) if p)
def business_hours():
hours = get_business().get("hours", {})
return f"{hours.get('weekday', 'Mon-Fri 9-5')}, {hours.get('saturday', '')}, {hours.get('sunday', '')}"
def agent_name():
return get_agent_config().get("assistant_name", "AI Assistant")
def model_name():
return get_agent_config().get("model", "gemini-2.0-flash-001")
def product_type():
return get_product_config().get("type", "products")
def product_singular():
return get_product_config().get("singular", "product")
def product_plural():
return get_product_config().get("plural", "products")