Repository navigation
[Evaluation] Consolidate _get_tool_calls_results/_reformat_tool_calls_results into _common/utils.py - #47842
[Evaluation] Consolidate _get_tool_calls_results/_reformat_tool_calls_results into _common/utils.py#47842Mohamed Hessien (m7md7sien) with Copilot wants to merge 5 commits into
Conversation
…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 resolve the merge conflicts in this pull request |
Co-authored-by: m7md7sien <16615690+m7md7sien@users.noreply.github.com>
Co-authored-by: m7md7sien <16615690+m7md7sien@users.noreply.github.com>
Merge conflicts resolved in commit
|
There was a problem hiding this comment.
Pull request overview
This PR consolidates tool-call extraction/formatting logic into azure.ai.evaluation._common.utils to eliminate duplication and ensure consistent argument/result rendering (including safe fallback logging that avoids leaking payload contents).
Changes:
- Centralized
_get_tool_calls_results/_reformat_tool_calls_resultsinto_common/utils.py, using_format_valuefor arguments and JSON-based serialization for structured tool results. - Added
_stringify_tool_resultand_log_safe_summaryhelpers to improve prompt readability and prevent sensitive-data leakage in fallback logs. - Removed the duplicated implementations from
_tool_call_success.pyand switched the evaluator to use the shared utilities.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_common/utils.py | Adds canonical tool-call/result formatting plus safe-logging helpers and fallback behavior. |
| sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluators/_tool_call_success/_tool_call_success.py | Removes local duplicated formatter implementations and imports the shared utilities instead. |
| from azure.ai.evaluation._common.utils import _log_safe_summary, _stringify_tool_result | ||
| from azure.ai.evaluation._common.utils import _log_safe_summary | ||
| from azure.ai.evaluation._common._experimental import experimental | ||
| from azure.ai.evaluation._common.utils import _get_tool_calls_results, _reformat_tool_calls_results |
|
Hi Copilot. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days. |
_tool_call_success.pydefined its own_get_tool_calls_resultsand_reformat_tool_calls_results, duplicating (and diverging from) equivalent logic elsewhere. The two copies formatted tool-call arguments differently:_tool_call_success.pyusedf'{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 viajson.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_valuefor args and_stringify_tool_resultfor results_reformat_tool_calls_results: safe wrapper around_get_tool_calls_resultswith fallback on parse failure, logging via_log_safe_summary_tool_call_success.py— Removed the 64-line duplicate definitions; imports_get_tool_calls_resultsand_reformat_tool_calls_resultsfrom_common/utils.pyinstead.