Skip to content

Conversation

@iBenzene
Copy link
Member

@iBenzene iBenzene commented Jan 16, 2026

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

Grounding and URL Context with Structured Outputs: You can now combine Gemini hosted tools, specifically Grounding with Google Search and URL context with structured outputs. This is especially powerful for building agents that need to fetch live information from the web or specific webpages and extract that data into a precise JSON format for downstream tasks.

- Add response_format parameter handling in FormatConverter
- Convert OpenAI json_schema format to Gemini responseSchema
- Support both json_schema and json_object modes
- Extract convertParameterTypes helper for reuse
- Add proper error handling and logging

Fixes #11

This comment was marked as resolved.

This comment was marked as resolved.

@bbbugg bbbugg merged commit b9a9994 into main Jan 18, 2026
6 checks passed
@github-actions
Copy link

🎉 此 PR 的修改已在版本 v0.4.0 中发布。
🎉 The changes in this PR have been released in version v0.4.0.

@iBUHub iBUHub deleted a comment from github-actions bot Jan 18, 2026
@bbbugg bbbugg deleted the feature/structured-output-support branch January 18, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feedback]: Request supported Structure Output

3 participants