Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I was going to ask if this or other Ollama models support structured output (like JSON).

Then a quick search revealed you can as of a free weeks ago

https://ollama.com/blog/structured-outputs



For structured output from anywhere I'm finding https://github.com/BoundaryML/baml good. It's more accurate than gpt-04-mini will do on its own, and any of the other JSON schema approaches I've tried.


Yeah it's not as strong as constrained beam search like OpenAI uses (at least afaik) but it works on any models that support tool calling. Just keep it simple, don't have a lot of deep nested structures or complicated rules.

Lots of other models will work nearly as well though if you just give them a clear schema to follow and ask them to output json only, then parse it yourself. Like I've been using gemma2:9b to analyze text and output a json structure and it's nearly 100% reliable despite it being a tiny model and not supporting tools or structured output officially.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: