You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: add security_risk and summary to tool examples for non-native function calling
This fixes issue #2175 where models using prompt-based function calling
(native_tool_calling=False) would fail to provide the security_risk parameter
because the examples in the system prompt didn't show it.
Changes:
- Add security_risk parameter to all tool examples in TOOL_EXAMPLES dict
- Add summary parameter to all tool examples for transparency
- Update in_context_learning_example.j2 template with the same parameters
The security_risk parameter is required when LLMSecurityAnalyzer is active,
and the summary parameter is always recommended for action transparency.
Fixes: #2175
Co-authored-by: openhands <openhands@all-hands.dev>
@@ -160,6 +164,7 @@ USER: EXECUTION RESULT of [terminal]:
160
164
A:
161
165
The server is running on port 5000 with PID 126. You can access the list of numbers in a table format by visiting http://127.0.0.1:5000. Let me know if you have any further requests!
162
166
<function=finish>
167
+
<parameter=summary>Task complete - Flask server running with table display</parameter>
163
168
</function>
164
169
165
170
--------------------- END OF EXAMPLE ---------------------
<parameter=new_str>return '<table>' + ''.join([f'<tr><td>{i}</td></tr>' for i in numbers]) + '</table>'</parameter>
250
+
<parameter=security_risk>MEDIUM</parameter>
251
+
<parameter=summary>Update return statement to render HTML table</parameter>
245
252
</function>
246
253
247
254
USER: EXECUTION RESULT of [str_replace_editor]:
@@ -267,6 +274,8 @@ def index():
267
274
goto('http://127.0.0.1:5000')
268
275
noop(1000) # Wait for page to load
269
276
</parameter>
277
+
<parameter=security_risk>LOW</parameter>
278
+
<parameter=summary>Navigate to localhost to verify page display</parameter>
270
279
</function>
271
280
272
281
USER: EXECUTION RESULT of [browser]:
@@ -292,6 +301,8 @@ def index():
292
301
if __name__ == '__main__':
293
302
app.run(port=5000)
294
303
</parameter>
304
+
<parameter=security_risk>MEDIUM</parameter>
305
+
<parameter=summary>Create Flask app.py with number list endpoint</parameter>
295
306
</function>
296
307
297
308
USER: EXECUTION RESULT of [edit_file]:
@@ -310,6 +321,8 @@ def index():
310
321
# ... existing code ...
311
322
if __name__ == '__main__':
312
323
</parameter>
324
+
<parameter=security_risk>MEDIUM</parameter>
325
+
<parameter=summary>Update index function to render HTML table</parameter>
313
326
</function>
314
327
315
328
USER: EXECUTION RESULT of [edit_file]:
@@ -331,6 +344,7 @@ def index():
331
344
The server is running on port 5000 with PID 126. You can access the list of numbers in a table format by visiting http://127.0.0.1:5000. Let me know if you have any further requests!
332
345
<function=finish>
333
346
<parameter=message>The task has been completed. The web server is running and displaying numbers 1-10 in a table format at http://127.0.0.1:5000.</parameter>
347
+
<parameter=summary>Task complete - Flask server running with table display</parameter>
334
348
</function>
335
349
"""# noqa: E501
336
350
},
@@ -340,6 +354,7 @@ def index():
340
354
Let me check the current task list first:
341
355
<function=task_tracker>
342
356
<parameter=command>view</parameter>
357
+
<parameter=summary>View current task list status</parameter>
343
358
</function>
344
359
""",
345
360
"plan": """
@@ -360,6 +375,7 @@ def index():
360
375
}
361
376
]
362
377
</parameter>
378
+
<parameter=summary>Update task plan with current progress</parameter>
0 commit comments