outlines icon indicating copy to clipboard operation
outlines copied to clipboard

Prevent Infinite Repetition in JSON Schemas with `number`

Open lapp0 opened this issue 1 year ago • 0 comments

What behavior of the library made you think about the improvement?

In JSON Schema safe_subset mode

  • whitespace cannot continue infinitely https://github.com/outlines-dev/outlines/pull/916
  • integer and string cannot continue infinitely https://github.com/dottxt-ai/outlines/pull/1154

However you can still produce infinite numbers in safe_subset mode.

How would you like it to behave?

Finish the safe_subset implementation in JSON Schema through

json_schema.py already has the following attributes which can be provided a safe_subset-mode default:

           bounds = {
                "minDigitsInteger",
                "maxDigitsInteger",
                "minDigitsFraction",
                "maxDigitsFraction",
                "minDigitsExponent",
                "maxDigitsExponent",
            }

Questions

  • Should we include details about reporting to the Outlines team or an explanation in the error dict? Or perhaps use a warning?

lapp0 avatar Sep 17 '24 16:09 lapp0