googleapis / googleapis/python-genai

Support a larger number of enum values when using structured output

Offen
#950 14 Kommentare 1 Reaktion 2 zugewiesene Personen Beansprucht von @kkorpal Auf GitHub ansehen
priority: p3 type: feature request
Vorherrschende Sprache
Python
Sterne
4k
Forks
1k
Ø Merge
2 T. 11 Std.
Gemergte PRs (30 T.)
40

Beschreibung

I am trying to use the Gemini Flash 2.0 models to produce a content classification with about 100 possible classes. Passing all 100 values to the response_schema of the structured output results in `400` errors due to the "complexity" of the schema.

When I include all possible values in the prompt instead, it will regularly produce outputs that are not one of the 100 class types, which is a deal-breaker for my use case.

https://ai.google.dev/gemini-api/docs/structured-output#generating-enums

> A complex schema can result in an InvalidArgument: 400 error. Complexity might come from long property names, long array length limits, enums with many values, objects with lots of optional properties, or a combination of these factors.

> Reduce the number of valid values for enums.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.