yetessam commited on
Commit
4a7f58e
·
verified ·
1 Parent(s): 624116f

Update agents/prompts.py

Browse files
Files changed (1) hide show
  1. agents/prompts.py +15 -9
agents/prompts.py CHANGED
@@ -1,12 +1,18 @@
1
- import yaml
2
 
3
  def load_prompts():
4
- """Load prompts.yaml and contentprompts.yml."""
5
- with open("config/prompts.yaml", 'r') as stream:
6
- prompt_templates = yaml.safe_load(stream)
 
 
 
 
7
 
8
- with open("config/contentprompts.yml", 'r') as stream:
9
- content_prompts = yaml.safe_load(stream)
10
-
11
- combined_prompts = {**prompt_templates, **content_prompts}
12
- return combined_prompts
 
 
 
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
+ }