Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -179,13 +179,22 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 179 |
|
| 180 |
|
| 181 |
# Add JSON parsing instructions to the agent prompt
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
|
| 190 |
agent = CodeAgent(
|
| 191 |
model=model,
|
|
|
|
| 179 |
|
| 180 |
|
| 181 |
# Add JSON parsing instructions to the agent prompt
|
| 182 |
+
if 'system' in prompt_templates:
|
| 183 |
+
prompt_templates['system'] += """
|
| 184 |
+
When using API tools:
|
| 185 |
+
1. Always parse JSON responses first
|
| 186 |
+
2. Check for "error" keys before proceeding
|
| 187 |
+
3. Use get() for optional fields
|
| 188 |
+
4. Handle empty values gracefully
|
| 189 |
+
"""
|
| 190 |
+
else:
|
| 191 |
+
prompt_templates['system'] = """
|
| 192 |
+
When using API tools:
|
| 193 |
+
1. Always parse JSON responses first
|
| 194 |
+
2. Check for "error" keys before proceeding
|
| 195 |
+
3. Use get() for optional fields
|
| 196 |
+
4. Handle empty values gracefully
|
| 197 |
+
"""
|
| 198 |
|
| 199 |
agent = CodeAgent(
|
| 200 |
model=model,
|