Open
Description
Background & Description
I was working on a C# class -> GBNF converter, and came across this:
https://github.com/ggerganov/llama.cpp/blob/master/grammars/README.md#json-schemas--gbnf
Here's an example, thanks to this reddit post.
Example JSON:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"reply": {"type": "string"},
"mood": {"type": "string"},
"intent": {"type": "string"}
},
"required": ["reply", "mood", "intent"]
}
Example output:
User: I gave you a cookie.
Please respond in JSON format with your reply, mood, and intent:
{"reply": "Thank you for the cookie! It's delicious!", "mood": "Happy", "intent": "Express gratitude" }
API & Usage
No response
How to implement
No response