Skip to content

Conversation

sdivye92
Copy link
Contributor

  • Fix ToolCallAccuracy returns score higher than 1.0 (ToolCallAccuracy returns score higher than 1.0 #2079)
    • Using zip to combine reference_tool_calls and pred_tool_calls
  • Updated is_sequence_aligned method to check for same len of pred and ref seq
    • This fixes issue when tool call accuracy is 1 even when pred_tool_calls has more tool calls than reference_tool_calls.
    • equal check between pred_sequence and ref_sequence will check that both should be same length.
    • when equal order of occurence of their elements are same.

sdivye92 added 2 commits June 26, 2025 08:28
- equal check between pred_sequence and ref_sequence will check that
  both should be same length
- when equal order of occurence of their elements are same
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 26, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Fixed critical scoring bug in ToolCallAccuracy metric where it could incorrectly return scores higher than 1.0 due to double-counting matches.

  • Modified ragas/src/ragas/metrics/_tool_call_accuracy.py to use zip() for one-to-one matching between reference and prediction tool calls
  • Updated is_sequence_aligned to enforce equal lengths between prediction and reference sequences
  • Added validation to ensure tool calls are made in correct order and quantity
  • Fixed edge case where perfect scores were given despite extra predicted tool calls

1 file reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

@anistark
Copy link
Contributor

Thanks for the PR @sdivye92

Some additional things needs to be added before we can merge:

  • Consider adding validation for mismatched lengths
  • Add example in docstring explaining the scoring logic

@anistark anistark added the blocked Blocked on further action label Aug 28, 2025
@anistark anistark mentioned this pull request Sep 22, 2025
@anistark
Copy link
Contributor

Taken up in #2300

@anistark anistark closed this Sep 22, 2025
anistark added a commit that referenced this pull request Sep 22, 2025
## Issue Link / Problem Description
<!-- Link to related issue or describe the problem this PR solves -->
- contd #2092

---------

Co-authored-by: sdivye92 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked on further action size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants