Re: failing structured output generation
Hi,
I was using gemma-3-4b for an application which involved structured output generation. I noticed that even upon prompting the model explicitly to generate valid json (with some rules also like 'do not miss right commas' and 'do not add unnecessary commas'), the model failed to generate valid JSON output. When I used Jsonparser, it keeps throwing errors. I suggest whosoever it may concern to look at this library called json-repair (https://pypi.org/project/json-repair/).
This library has been around for close to 2 years. You can use this to, say finetune the llm or future llms to produce more robust json output instead of letting users break their heads on how to get valid json output.
Hope this helps.
For simple users, do not directly go for jsonparser. Use the aforementioned library and chill!