fix(responses): generalize tool call parsing for reasoning models#1799
Merged
jxnl merged 3 commits into567-labs:mainfrom Sep 5, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 9eca15c in 52 seconds. Click for details.
- Reviewed
53lines of code in1files - Skipped
0files when reviewing. - Skipped posting
3draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. instructor/processing/function_calls.py:556
- Draft comment:
Removed the unused 'using_inbuilt_tools' parameter from the function signature. This simplification cleans up the interface and removes redundant branching logic. - Reason this comment was not posted:
Confidence changes required:0%<= threshold85%None
2. instructor/processing/function_calls.py:561
- Draft comment:
The loop now iterates safely over 'completion.output' to find the matching tool call. Consider using a for-else construct to make the intent even clearer. - Reason this comment was not posted:
Confidence changes required:33%<= threshold85%None
3. instructor/processing/function_calls.py:567
- Draft comment:
Enhanced error handling is now in place if no matching tool call is found. It might be beneficial to ensure that 'completion.output' is always a list to avoid unexpected errors. - Reason this comment was not posted:
Confidence changes required:33%<= threshold85%None
Workflow ID: wflow_xoFCSICcoQAyXZAS
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Collaborator
|
@claude please review this |
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Contributor
Author
|
@jxnl are the tests and claude expected to succeed? My changes are not related to the errors |
Collaborator
|
I just approved workflows to run. Since they cost credits, I try not to make every pull request run everything. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes a bug in
parse_responses_toolsmethod that caused failures when using reasoning models wherecompletion.output[0]may not exist or may not have the expectednameattribute.Problem
The previous implementation made unsafe assumptions about the response structure:
using_inbuilt_toolsparameter to handle different response types with branching logiccompletion.output[0]without checking if it exists or has the expected propertiesSolution
using_inbuilt_toolsparameter and conditional logiccompletion.outputto find the matching tool callChanges
using_inbuilt_toolsparameter fromparse_responses_toolsmethod signaturecompletion.output[0]access with defensive iterationImportant
Fixes
parse_responses_toolsto safely handle reasoning models by iterating overcompletion.outputand removing unsafe assumptions.parse_responses_toolsto handle reasoning models wherecompletion.output[0]may not exist or lacknameattribute.completion.outputto find matching tool call, removing unsafe direct access.using_inbuilt_toolsparameter fromparse_responses_tools.This description was created by
for 9eca15c. You can customize this summary. It will automatically update as commits are pushed.