Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefixItems keyword is not constraining output types #111

Open
cikkle opened this issue Jun 5, 2024 · 1 comment
Open

prefixItems keyword is not constraining output types #111

cikkle opened this issue Jun 5, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@cikkle
Copy link

cikkle commented Jun 5, 2024

See this issue.

I'm using lm-format-enforcer through tabbyAPI's streaming completions API and it doesn't appear to be following type constraints given using the prefixItems keyword. I reported this with them first on the oft chance the problem might lie outside the library somehow, but they didn't find it likely.

Verbatim from the other incident:

To Reproduce
This is an example schema I tested:

 { 
     "type": "array",
     "prefixItems": [
         { "const": "FIXED" },
         { "type": "number" },
         { "type": "string" }     
     ],
     "minItems": 3,
     "maxItems": 3
}

On different attempts, I get back things like:

[12185635797, 56, "Hello"]
[20020715, 13, 2002]
["hello", 13, "World"]
[1.14, 1.13,1.12]

Expected behavior
The output should follow the constraints of the prefixItems keyword in the schema, e.g.:

[ "FIXED", 3245.34, "hello"]

@noamgat noamgat added the enhancement New feature or request label Jun 6, 2024
@noamgat
Copy link
Owner

noamgat commented Jun 6, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants