Skip to content

[Evaluation] Consolidate _get_tool_calls_results/_reformat_tool_calls_results into _common/utils.py#47842

Draft
m7md7sien with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-imports-in-tool-call-success
Draft

[Evaluation] Consolidate _get_tool_calls_results/_reformat_tool_calls_results into _common/utils.py#47842
m7md7sien with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-imports-in-tool-call-success

Conversation

Copilot AI commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

_tool_call_success.py defined its own _get_tool_calls_results and _reformat_tool_calls_results, duplicating (and diverging from) equivalent logic elsewhere. The two copies formatted tool-call arguments differently: _tool_call_success.py used f'{k}="{v}"' (all values quoted), while the utils path used _format_value(v) (numbers unquoted, None"None").

Changes

  • _common/utils.py — Added:

    • _stringify_tool_result: renders tool results as LLM-readable strings (list/dict → JSON via json.dumps, None"", str passthrough)
    • _log_safe_summary: shape-only structural summary for safe logging (avoids leaking PII/customer data into telemetry)
    • _get_tool_calls_results: canonical implementation using _format_value for args and _stringify_tool_result for results
    • _reformat_tool_calls_results: safe wrapper around _get_tool_calls_results with fallback on parse failure, logging via _log_safe_summary
  • _tool_call_success.py — Removed the 64-line duplicate definitions; imports _get_tool_calls_results and _reformat_tool_calls_results from _common/utils.py instead.

…ool_calls_results from _common/utils.py

- Add _stringify_tool_result and _log_safe_summary to _common/utils.py
- Add improved _get_tool_calls_results and _reformat_tool_calls_results to _common/utils.py (using _format_value and _stringify_tool_result for consistent arg/result formatting)
- Remove duplicate local definitions from _tool_call_success.py
- Import _get_tool_calls_results and _reformat_tool_calls_results from _common/utils.py in _tool_call_success.py

Co-authored-by: m7md7sien <16615690+m7md7sien@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix imports in _tool_call_success.py [Evaluation] Consolidate _get_tool_calls_results/_reformat_tool_calls_results into _common/utils.py Jul 6, 2026
Copilot AI requested a review from m7md7sien July 6, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants