Conversation
Validate the complete payload once for regular schemas and only validate individual tool calls when the payload is an OpenAI function-calling list.
Contributor
|
@Harbor404 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Hi @Harbor404, thanks for your interest in contributing to Haystack! 🙏 ⛔ First-time contributors can have at most 1 open pull request in this repository until it has been approved, so this PR was closed automatically. Your open pull request #13059 is unaffected. Once it has been approved by a maintainer, you are welcome to open more PRs. Feel free to reopen this one at that point. See the contributing guidelines for details. 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
Proposed Changes
JsonSchemaValidatortreated every top-level JSON array as a list of OpenAI function-calling tool calls. As a result,[1, 2]was validated element-by-element against an array schema, while[]skipped validation entirely and could bypassminItems.This change validates the whole payload once for regular schemas. Per-message validation now runs only for OpenAI function-calling schemas or non-empty function-calling message lists, preserving the existing tool-call behavior.
JsonSchemaValidator.run()to choose whole-payload or per-tool-call validation based on the schema and payload.minItems.How did you test it?
hatch run test:unit test/components/validators/test_json_schema.py -q --no-cov --tb=short22 passedhatch run test:types haystack/components/validators/json_schema.pySuccess: no issues found in 1 source filehatch run fmt-check haystack/components/validators/json_schema.py test/components/validators/test_json_schema.pyBefore the fix, the two new tests failed as expected:
[1, 2]producedvalidation_error, and[]was accepted.Notes for the reviewer
Function-calling payloads may use either a full OpenAI function-calling schema or a schema that describes one function-call object while the message contains a list. Both existing paths are preserved by detecting non-empty function-calling message lists instead of always iterating over arrays.
This PR is a draft because the repository currently allows only one non-draft PR per community contributor, and #13059 is already open. It can be marked ready for review once that PR is merged or closed.
This PR was fully generated with an AI assistant. I have reviewed the changes and run the relevant tests.
Checklist