Skip to content

Conversation

neokn
Copy link

@neokn neokn commented Oct 6, 2025

This commit adds comprehensive support for handling reasoning_content in OpenAI Compatible API Chat Completions responses, supporting both streaming and non-streaming scenarios. The implementation ensures that models supporting reasoning_content can properly return their reasoning traces, with optimized content assembly and enhanced response_format handling.

CHANGELOG:

  • Add reasoning_content handling in fromOpenAIChoice and fromOpenAIChunkChoice
  • Implement direct content assembly by pushing reasoning and content parts to content array
  • Update response_format handling in toOpenAIRequestBody to support schema-based responses
  • Add comprehensive test cases for reasoning_content in both streaming and non-streaming functions
  • Add test for json_schema response_format in toOpenAIRequestBody

Description here... Help the reviewer by:
OpenAI it self not support reasoning_content but

support reasoning_content when using reasoning model

Checklist (if applicable):

Copy link

google-cla bot commented Oct 6, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@neokn
Copy link
Author

neokn commented Oct 8, 2025

Hi @pavelgj, just wanted to kindly check if you’ve had a chance to look at this PR.
Please let me know if there’s anything I can update or clarify. Thanks a lot!

@pavelgj pavelgj requested a review from ssbushi October 16, 2025 17:09
@pavelgj
Copy link
Collaborator

pavelgj commented Oct 16, 2025

@ssbushi could you please take a look?

This commit adds comprehensive support for handling reasoning_content in OpenAI Compatible API Chat Completions responses, supporting both streaming and non-streaming scenarios. The implementation ensures that models supporting reasoning_content can properly return their reasoning traces, with optimized content assembly and enhanced response_format handling.

**CHANGELOG:**
- [x] Add reasoning_content handling in fromOpenAIChoice and fromOpenAIChunkChoice
- [x] Implement direct content assembly by pushing reasoning and content parts to content array
- [x] Update response_format handling in toOpenAIRequestBody to support schema-based responses
- [x] Add comprehensive test cases for reasoning_content in both streaming and non-streaming functions
- [x] Add test for json_schema response_format in toOpenAIRequestBody

**Key features:**
- Enables proper reasoning trace returns from supporting models
- Enhanced compatibility with schema-based response formats
- Complete test coverage for new reasoning_content functionality
@neokn neokn changed the title feat(js/plugins/compat-oai): Add reasoning_content support to OpenAI Compatible API plugin feat(js/plugins/compat-oai): Add reasoning_content and json_schema support to OpenAI Compatible API plugin Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants