(tool_call: dict[str, Any])
| 1440 | |
| 1441 | |
| 1442 | def _tool_call_command(tool_call: dict[str, Any]) -> str: |
| 1443 | fn = tool_call.get("function") or {} |
| 1444 | if not isinstance(fn, dict): |
| 1445 | return "" |
| 1446 | raw_args = fn.get("arguments") |
| 1447 | if isinstance(raw_args, str): |
| 1448 | try: |
| 1449 | parsed = json.loads(raw_args) |
| 1450 | except json.JSONDecodeError: |
| 1451 | return raw_args |
| 1452 | if isinstance(parsed, dict) and isinstance(parsed.get("command"), str): |
| 1453 | return str(parsed["command"]) |
| 1454 | return "" |
| 1455 | |
| 1456 | |
| 1457 | def _command_for_tool_result( |
no test coverage detected