fix(core): catch ValueError and TypeError in Refine structured output handlers#21237
Closed
GopalGB wants to merge 2 commits intorun-llama:mainfrom
Closed
fix(core): catch ValueError and TypeError in Refine structured output handlers#21237GopalGB wants to merge 2 commits intorun-llama:mainfrom
GopalGB wants to merge 2 commits intorun-llama:mainfrom
Conversation
…th invalid IDs Build a filtered list of valid node IDs instead of mutating the input list during iteration. The previous approach could skip elements when removing items from a list while iterating over it, allowing invalid IDs to reach _index_struct.delete_nodes() and cause a KeyError. Fixes run-llama#21066
… handlers The function-calling structured-output path can raise ValueError (for missing/failed tool calls) and TypeError (for non-BaseModel tool outputs) in addition to ValidationError. These were uncaught, causing queries to fail instead of falling through to the warning path. Broadens the except clause in all four structured response try/except blocks (_give_response_single, _refine_response_single, and their async counterparts) to also catch ValueError and TypeError. Fixes run-llama#21089
Contributor
|
hi @GopalGB there is already a PR open on this issue since couple of weeks with same changes... |
Author
|
Hey @gautamvarmadatla, my bad — should have checked open PRs before picking up the issue. Closing this one. Your PR has priority. |
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.
Summary
Refineresponse synthesizer to catchValueErrorandTypeErroralongsideValidationError_give_response_single,_refine_response_single, and their async counterpartsRoot Cause
After changes in #21036, the function-calling structured-output path can raise:
ValueErrorfor missing/failed tool callsTypeErrorfor non-BaseModel tool outputsThese were not caught by the
except ValidationErrorclause, causing the query to fail instead of falling through to the existing warning/fallback path.Test Plan
ValidationError— still caught and logged as beforeValueErrorandTypeErrornow trigger the same warning path instead of propagatingFixes #21089