Live data from Hacker News

Structured Outputs with Ollama

ollama.com

31–40 of 75 posts

Re: Structured Outputs with Ollama

#31

So I can use this with any supported models? The reason I'm asking is because I can only run 1b-3b models reliably on my hardware.

Hey! Author of the blog post here. Yes you should be able to use any model. Your mileage may vary with the smaller models but asking them to “return x in json” tends to help with accuracy (anecdotally).

Do you happen to know if got-4o would be negatively affected by the addition of “return x in json”? I’m debating whether I could use the same prompt across all models, hosted and ollama.

Re: Structured Outputs with Ollama

#33
That's very useful. To see why, try to get an LLM _reliably_ generate JSON output without this. Sometimes it will, but sometimes it'll just YOLO and produce something you didn't ask for, that can't be parsed.

Re: Structured Outputs with Ollama

#34
No way. This is amazing and one of the things I actually wanted. I love ollama be because it makes using an LLM feel like using any other UNIX program. It makes LLMs feel like they belong on UNIX.

Question though. Has anyone had luck running it on AMD GPUs? I've heard it's harder but I really want to support the competition when I get cards next year.

Re: Structured Outputs with Ollama

#35
post #30
post #29

Earlier quoted context omitted.

A lot of the time you can prevent this by prefilling the output with ```\n and stopping at ```.

care to explain further? I am not sure I understand you fully

``` is markdown for pre formatted text. It puts the LLM in the mood of generating machine readable data instead of prose.

Re: Structured Outputs with Ollama

#38
I must say it is nice to see the curl example first. As much as I like Pydantic, I still prefer to hand-code the schemas, since it makes it easier to move my prototypes to Go (or something else).

Re: Structured Outputs with Ollama

#39

No way. This is amazing and one of the things I actually wanted. I love ollama be because it makes using an LLM feel like using any other UNIX program. It makes LLMs feel like they belong on UNIX. Question though. Has anyone had luck running it on AMD GPUs? I've heard it's harder but I really want to support the competition when I get cards next year.

Yes, even on iGPUs. I was running it fairly well on a mini-PC with a 780M and the BIOS a set to allocate 16GB of shared memory to it.

Re: Structured Outputs with Ollama

#40
post #30
post #29

Earlier quoted context omitted.

A lot of the time you can prevent this by prefilling the output with ```\n and stopping at ```.

care to explain further? I am not sure I understand you fully

A lot of the time you can prevent this by prefilling the output with "```\n", and stopping at "```".
Post reply on HN