Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,10 +20,17 @@ final_answer = FinalAnswer()
|
|
| 20 |
with open(os.path.join(CURRENT_DIR, "prompts.yaml"), "r") as f:
|
| 21 |
prompt_templates = yaml.safe_load(f)
|
| 22 |
|
| 23 |
-
# 2)
|
| 24 |
-
|
| 25 |
-
if
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
agent = CodeAgent(
|
| 29 |
model=model,
|
|
|
|
| 20 |
with open(os.path.join(CURRENT_DIR, "prompts.yaml"), "r") as f:
|
| 21 |
prompt_templates = yaml.safe_load(f)
|
| 22 |
|
| 23 |
+
# 2) Recursively stringify any non-str leaves, preserving nested dicts
|
| 24 |
+
def stringify_leaves(obj):
|
| 25 |
+
if isinstance(obj, dict):
|
| 26 |
+
return { k: stringify_leaves(v) for k, v in obj.items() }
|
| 27 |
+
elif isinstance(obj, list):
|
| 28 |
+
# join lists of things into one big string
|
| 29 |
+
return "".join(stringify_leaves(v) for v in obj)
|
| 30 |
+
else:
|
| 31 |
+
return str(obj)
|
| 32 |
+
|
| 33 |
+
prompt_templates = stringify_leaves(raw_templates)
|
| 34 |
|
| 35 |
agent = CodeAgent(
|
| 36 |
model=model,
|