-
Notifications
You must be signed in to change notification settings - Fork 58
Description
There are two things that I would love to be able to do from the python bindings:
- Given a jsonschema, normalize it (e.g., remove the
allOfetc.) and give me back the normalizedSchema(even a simple debug-stringified version of the final internalSchemainstance would be better than nothing, but preferably, allow me to access the actualSchemaobject itself so I can recurse over it in any way I want.)
Why: Given that OpenAI is also using this library for structured outputs, this would allow me to quickly sanity-check all my relevant schemas before I send them off to OpenAI to make sure they are how I want them to look before they get turned into a grammar.
- Given a jsonschema (or
Schema, if (1) allows me to access it), give me back the final low-level grammar representation of that schema (again, even a simple debug output would be totally great)
Why: this would allow me even more visibility into the schemas I write to make sure the grammar makes sense, and if not, to tweak the schemas as necessary.
I spent some time digging into the existing python bindings and I can't figure out any way to do either of these things (I thought for sure LLMatcher.grammar_from_json_schema() would work but that just gives me back the same schema I put in, except wrapped in a "grammars" array). But if there is a way that I've missed, please let me know.