With model 0.5, Ollama launched a major enhancement to its LLM API. By introducing structured outputs, Ollama now makes it potential to constrain a mannequin’s output to a selected format outlined by a JSON schema. Underneath the hood, most methods use Pydantic’s capabilities to allow this.
Structured output solves a nagging downside many builders face when a system or course of takes the output from an LLM for additional processing. It’s vital for that system to “know” what to anticipate as its enter to course of it precisely with repeatable outcomes every time.
Likewise, you need to show mannequin output in the identical format every time you show it to a consumer to keep away from confusion and errors
Till now, making certain constant output codecs from most fashions has been a ache, however the brand new performance from Ollama makes doing so fairly simple, as I hope to indicate in my instance code snippets.
Earlier than that, although, it’s essential to set up the most recent model of Ollama. This isn’t a tutorial on Ollama or how one can run it. If you would like that info, click on my article beneath, the place I’m going via all that good things.