2 ms·
I just added a very cool feature that lets you supply a sample JSON file and it will automatically generate a BNF grammar for it. You can also supply a pydantic
by eigenvalue 3y ago
I just added a very cool feature that lets you supply a sample JSON file and it will automatically generate a BNF grammar for it. You can also supply a pydantic data model description and it will generate the corresponding JSON BNF for you:
https://github.com/Dicklesworthstone/swiss_army_llama/blob/main/grammar_builder.py https://github.com/Dicklesworthstone/swiss_army_llama/blob/m...
And then you can add that grammar file and it will validate it with this:
https://github.com/Dicklesworthstone/swiss_army_llama/blob/50199dac15c40549443f8a6912d6acd94a645f2e/service_functions.py#L619 https://github.com/Dicklesworthstone/swiss_army_llama/blob/5...