Skip to content

Conversation

@aldehir
Copy link
Collaborator

@aldehir aldehir commented Sep 6, 2025

fix #15823

The allOf logic only supports object schemas with properties, this PR extends it to support enum as well.

Strictly speaking, combining allOf with enum should only consider the intersect of all sub-schemas. This PR violates that by aggregating them to minimize complexity. I can add the intersection if desired, I just didn't think it was worth the hassle.

@deiteris
Copy link

deiteris commented Sep 6, 2025

I'm not sure the current implementation considers the intersection even for properties (with additionalProperties: false there must be an intersection as well, which can be a pita). From the correctness standpoint, intersection is a must here, otherwise the resulting grammar will not be equivalent to the rule you define, but ofc it depends on expected usage. For example the following schema:

{
  "allOf": [
      {"$ref": "#/definitions/foo"},
      {"$ref": "#/definitions/bar"}
  ],
  "definitions": {
      "foo": {
          "type": "string",
          "enum": ["a", "b"]
      },
      "bar": {
          "type": "string",
          "enum": ["b", "c"]
      }
  }
}

In your case will produce an aggregate of enums and your resulting rule will be able to match "a", "b", "b", and "c". But if you validate the same data against the original schema using a compliant JSON Schema validator, only "b" will pass.

@directrix1
Copy link

This fixed my issue with using Zed editor which was defining tool calls with this kind of schema.

@aldehir
Copy link
Collaborator Author

aldehir commented Sep 6, 2025

For the sake of correctness, I added the intersection logic. That said, I highly doubt clients are going to add multiple enum schemas.

@aldehir aldehir merged commit 7057faf into ggml-org:master Sep 8, 2025
50 checks passed
njsyw1997 pushed a commit to aizip/llama.cpp that referenced this pull request Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples python python script changes server testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eval bug: "edit_file" tool call does not allow "mode" argument to be set

4 participants