Repository navigation
fix: parse empty tool call arguments in the non-streaming OpenAI generators - #13047
Merged
Merged
Conversation
Contributor
|
@chrikrah is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||
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.
Related Issues
ChatMessage.from_openai_dict_format, and fix: accept dict tool arguments in ChatMessage.from_openai_dict_format #12790 moved that into_parse_openai_tool_call_arguments. This fixes the two non-streaming generator paths.Proposed Changes:
openai.py:671andopenai_responses.py:695calljson.loadson the arguments of each tool call. OpenAI-compatible servers such as vLLM send""for a tool with no parameters (vllm-project/vllm#19419);Noneis covered as a defensive case. The converter then drops the call with the "malformed JSON" warning, or the reply raisesTypeError. Both streaming paths already turn""into{}.Both sites now use
_parse_openai_tool_call_argumentsfrom #12790. Malformed JSON is still skipped. A call cut off atfinish_reason: lengthwith empty arguments now becomes{}, as it already does when streaming, and_check_finish_reasonstill logs the truncation on Chat Completions.How did you test it?
One parametrized test per generator, for
""andNone.Notes for the reviewer
The Azure generators inherit both methods.
Checklist
@sjrl, you merged #12790 and kept invalid JSON raising. The string
"null"still parses toNoneand becomesToolCall.arguments. Should the helper map it to{}too?