4 ms·
Not so fast! Check this out https://github.com/googleapis/python-genai/issues/460 https://github.com/googleapis/python-genai/issues/460 In my experience, you c
by roflcopter69 8mo ago
Not so fast! Check this out https://github.com/googleapis/python-genai/issues/460 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.
- jiggawatts 8mo agoThat'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-tools/gemini-api-structured-outputs/ https://blog.google/innovation-and-ai/technology/developers-...
- roflcopter69 8mo agoFixed 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.