googleapis / googleapis/python-genai

Support a larger number of enum values when using structured output

未关闭
#950 14 条评论 1 个 reaction 已指派 2 人 已被 @kkorpal 认领 在 GitHub 查看
priority: p3 type: feature request
主要语言
Python
星标
4k
派生
1k
平均合并
2 天 12 小时
30 天内合并 PR
41

描述

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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。