Spaces:
Sleeping
Sleeping
Update agents/prompts.py
Browse files- agents/prompts.py +15 -9
agents/prompts.py
CHANGED
|
@@ -1,12 +1,18 @@
|
|
| 1 |
-
import yaml
|
| 2 |
|
| 3 |
def load_prompts():
|
| 4 |
-
"
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
import yaml, json
|
| 2 |
|
| 3 |
def load_prompts():
|
| 4 |
+
files = ["config/prompts.yaml", "config/contentprompts.yml"]
|
| 5 |
+
merged = {}
|
| 6 |
+
for path in files:
|
| 7 |
+
with open(path, "r", encoding="utf-8") as f:
|
| 8 |
+
data = yaml.safe_load(f) or {}
|
| 9 |
+
if isinstance(data, dict):
|
| 10 |
+
merged.update(data)
|
| 11 |
|
| 12 |
+
# Coerce all values to strings (safe for smolagents)
|
| 13 |
+
return {
|
| 14 |
+
str(k): v if isinstance(v, str)
|
| 15 |
+
else json.dumps(v, ensure_ascii=False) if isinstance(v, (dict, list, tuple))
|
| 16 |
+
else str(v)
|
| 17 |
+
for k, v in merged.items()
|
| 18 |
+
}
|