RicoSuter / NJsonSchema

JSON Schema reader, generator and validator for .NET
http://NJsonSchema.org
MIT License
1.38k stars 532 forks source link

Add GBNF generation from C#/JSON Schema for Large Language Models (LLMS) #1659

Open JohnGalt1717 opened 8 months ago

JohnGalt1717 commented 8 months ago

The best way to ensure that LLMs return structured data properly is using GBNF format. It would be great if NJsonSchema generated GBNF formats.

Here's some documentation on it and examples:

https://github.com/ggerganov/llama.cpp/tree/master/grammars https://github.com/IntrinsicLabsAI/gbnfgen