KidIkaros commited on
Commit
164d007
·
verified ·
1 Parent(s): cfa3668

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -7
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
- prompt_templates['system'] += """
183
- When using API tools:
184
- 1. Always parse JSON responses first
185
- 2. Check for "error" keys before proceeding
186
- 3. Use get() for optional fields
187
- 4. Handle empty values gracefully
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,