fix: accept dict tool arguments in ChatMessage.from_openai_dict_format - #12790
Open
MohammadHijjawi97 wants to merge 1 commit into
Open
MohammadHijjawi97 wants to merge 1 commit into
MohammadHijjawi97 wants to merge 1 commit into
Conversation
Some OpenAI-compatible servers send parsed argument objects. json.loads then raised TypeError. Invalid JSON strings are treated as an empty mapping. Co-authored-by: Cursor <cursoragent@cursor.com>
MohammadHijjawi97
requested review from
sjrl
and removed request for
a team
September 17, 2026 11:05
|
@MohammadHijjawi97 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
This was referenced Sep 17, 2026
Contributor
|
Hi @MohammadHijjawi97, thanks for your interest in contributing to Haystack! 🙏 This is an automated message to help us keep the review queue healthy. |
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
No existing issue. This PR includes a regression test for the crash.
Proposed Changes:
Proposed Changes:
ChatMessage.from_openai_dict_formatalways passed tool-callargumentstojson.loads. Some OpenAI-compatible servers already send a parsed dict, which raisedTypeError. Invalid JSON strings also crashed. Accept a dict payload, treat empty/null/invalid JSON as{}.How did you test it?
Added unit tests for dict arguments and invalid JSON. Existing empty/missing argument tests still pass.
Notes for the reviewer
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.