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

Is this me or Sam is being absolute sore loser he is and trying to steal Opus thunder?




Why is it loser? He very well could be a sore winner here.

OpenAI is still the only AI company that has structured outputs. Anthropic now supports JSON schema but you can't specify array length.

Google Gemini definitely has structured output.

Not so fast! Check this out https://github.com/googleapis/python-genai/issues/460

In my experience, you can only use Gemini structured outputs for the most trivial of schemas. No integer literals, no discriminated unions and many more paper cuts. So at least for me, it was completely unusable for what I do at work.


That's the level of coding I expect from a bunch of Python-only ML computer scientists, but still... wow.

On the upside, they seem to have fixed it: https://blog.google/innovation-and-ai/technology/developers-...


Fixed some of the things, indeed. But don't let this blog post fool you. When using discriminated unions, Pydantic exports JSON schema with `oneOf` while the google-genai expects `anyOf` so that does not work out of the box. Also it still does not support basic stuff like when you have this in you Pydantic model: `foo: Literal[1, 3, 5]`

It's still far from what I'd expect should be supported.


Can you elaborate what you mean - OAI structured outputs means JSON schema doesn't it? So are you just saying they both support JSON schema but Anthropic has a limitation?

OpenAI, in addition to JSON schema, supports "context-free grammar"[0], i.e. regex and lark. Anthropic also supports JSON schema since a few weeks ago, but they don't support specifying the length of JSON array, so you still have to worry about the model producing invalid output.

[0]: https://platform.openai.com/docs/guides/function-calling#con...

One thing that pisses me off is this widespread misunderstanding that you can just fall back to function calling (Anthropic's function calling accepts JSON schema for arguments), and that it's the same as structured outputs. It is not. They just dump the JSON schema into the context without doing the actual structured outputs. Vercel's AI SDK does that and it pisses me off because doing that only confuses the model and prefilling works much better.


They both are doing this to each other.

BTW, loser is spelled with a single o.


You could also claim that Anthropic is trying to scoop OpenAI by launching minutes earlier, as OpenAI has done with Google in the past.

For downvoters, you must be naive to think these companies are not surveilling each other through various means.


lol cope harder



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

Search: