Skip to content

fix: /v1/chat/completions -> /v1/responses json_schema - #2876

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/json_schema
Feb 6, 2026
Merged

fix: /v1/chat/completions -> /v1/responses json_schema#2876
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/json_schema

Conversation

@seefs001

@seefs001 seefs001 commented Feb 6, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Refactor

    • Improved internal response format handling and centralized format conversion logic for better maintainability.
  • Bug Fixes

    • Removed max_output_tokens minimum constraint enforcement.

@coderabbitai

coderabbitai Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

A helper function convertChatResponseFormatToResponsesText() is introduced to consolidate ResponseFormat-to-JSON conversion logic. The function replaces inlined construction in ChatCompletionsRequestToResponsesRequest. A commented note documents an OpenAI constraint regarding max_output_tokens minimum boundary.

Changes

Cohort / File(s) Summary
Response Format Conversion Helper
service/openaicompat/chat_to_responses.go
Extracted convertChatResponseFormatToResponsesText() function to handle ResponseFormat serialization with support for json_schema merging and fallback embedding. Refactored existing call site to use the new helper instead of inlined logic. Added clarifying comment on OpenAI max_output_tokens constraint.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A helper hops into view,
Consolidating what was split in two,
ResponseFormats now find their place,
In functions clean with gentle grace,
Code blooms clearer, day by day!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing json_schema handling in the conversion from /v1/chat/completions to /v1/responses endpoint.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Calcium-Ion
Calcium-Ion merged commit f18aec5 into QuantumNous:main Feb 6, 2026
1 check passed
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
fix: /v1/chat/completions -> /v1/responses json_schema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants