feat: add support for OpenAI structured output (response_format) #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds support for OpenAI's structured output feature (response_format parameter) by converting it to Gemini's responseSchema format. The implementation reuses and extends existing type conversion logic to handle both tool parameters and response schemas, with stricter validation rules for structured outputs.
此拉取请求通过将其转换为 Gemini 的 responseSchema 格式,增加了对 OpenAI 的结构化输出功能(response_format 参数)的支持。该实现重用并扩展了现有的类型转换逻辑,以处理工具参数和响应模式,并对结构化输出采用更严格的验证规则。
docs: https://ai.google.dev/gemini-api/docs/structured-output?example=recipe#structured_outputs_with_tools
Grounding and URL Context with Structured Outputs is allowed for gemini 3