The following schema:
from genlm.control.potential.built_in.json import JsonSchema
potential = JsonSchema({
"type": "array",
"items": {"anyOf": [{"type": "integer"}, {"type": "number"}]},
})
print(await potential.complete(b'[0.0]'))
This prints -inf. It should print 0.0.
The underlying problem is that our fail fast parser is not handling the union correctly. It's parsing the first element as 0, then erroring when it sees a . rather than a , after it. We need to add some lookahead to the integer parser.
The following schema:
This prints -inf. It should print 0.0.
The underlying problem is that our fail fast parser is not handling the union correctly. It's parsing the first element as
0, then erroring when it sees a.rather than a,after it. We need to add some lookahead to the integer parser.