[PR #190] [CLOSED] fix: enable reasoning content preservation for OpenAI, GLM, and Qwen providers #225

Closed
opened 2026-06-06 22:09:46 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/vxcontrol/pentagi/pull/190
Author: @mason5052
Created: 3/10/2026
Status: Closed

Base: masterHead: fix/glm-qwen-preserve-reasoning


📝 Commits (2)

  • a7180da fix: enable reasoning content preservation for GLM and Qwen providers
  • 6fb3873 fix: also enable reasoning content preservation for OpenAI provider

📊 Changes

3 files changed (+3 additions, -0 deletions)

View changed files

📝 backend/pkg/providers/glm/glm.go (+1 -0)
📝 backend/pkg/providers/openai/openai.go (+1 -0)
📝 backend/pkg/providers/qwen/qwen.go (+1 -0)

📄 Description

Summary

OpenAI, GLM, and Qwen providers have models that support thinking/reasoning mode but their OpenAI client initialization was missing the WithPreserveReasoningContent() option. DeepSeek and Kimi providers already have this option enabled. This inconsistency could cause reasoning content to be silently dropped during inference when using thinking-capable models.

Changes

  • Added openai.WithPreserveReasoningContent() to openai.New() call in backend/pkg/providers/openai/openai.go
  • Added openai.WithPreserveReasoningContent() to openai.New() call in backend/pkg/providers/glm/glm.go
  • Added openai.WithPreserveReasoningContent() to openai.New() call in backend/pkg/providers/qwen/qwen.go

This makes all openai.New()-based providers consistent with DeepSeek and Kimi.

Provider Comparison (Before / After)

Provider Thinking Models WithPreserveReasoningContent (Before) After
DeepSeek deepseek-reasoner Yes Yes
Kimi kimi-k2.5, kimi-k2-thinking Yes Yes
OpenAI o3, o3-pro, o1, gpt-5.2, +15 more No Yes
GLM glm-5, glm-4.7-flashx, +9 more No Yes
Qwen qwq-32b, qwen3-235b-a22b, +20 more No Yes

Test plan

  • Verified all three packages compile cleanly: go build ./pkg/providers/openai/ ./pkg/providers/glm/ ./pkg/providers/qwen/
  • Existing provider tests remain unaffected
  • Manual verification: reasoning output should be preserved when using thinking-capable models

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/vxcontrol/pentagi/pull/190 **Author:** [@mason5052](https://github.com/mason5052) **Created:** 3/10/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix/glm-qwen-preserve-reasoning` --- ### 📝 Commits (2) - [`a7180da`](https://github.com/vxcontrol/pentagi/commit/a7180da2811a36c5b2b080d9369da4c338719fb4) fix: enable reasoning content preservation for GLM and Qwen providers - [`6fb3873`](https://github.com/vxcontrol/pentagi/commit/6fb3873943ab2690b6560969938aa0ece92b58c6) fix: also enable reasoning content preservation for OpenAI provider ### 📊 Changes **3 files changed** (+3 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `backend/pkg/providers/glm/glm.go` (+1 -0) 📝 `backend/pkg/providers/openai/openai.go` (+1 -0) 📝 `backend/pkg/providers/qwen/qwen.go` (+1 -0) </details> ### 📄 Description ## Summary OpenAI, GLM, and Qwen providers have models that support thinking/reasoning mode but their OpenAI client initialization was missing the `WithPreserveReasoningContent()` option. DeepSeek and Kimi providers already have this option enabled. This inconsistency could cause reasoning content to be silently dropped during inference when using thinking-capable models. ## Changes - Added `openai.WithPreserveReasoningContent()` to `openai.New()` call in `backend/pkg/providers/openai/openai.go` - Added `openai.WithPreserveReasoningContent()` to `openai.New()` call in `backend/pkg/providers/glm/glm.go` - Added `openai.WithPreserveReasoningContent()` to `openai.New()` call in `backend/pkg/providers/qwen/qwen.go` This makes all `openai.New()`-based providers consistent with DeepSeek and Kimi. ## Provider Comparison (Before / After) | Provider | Thinking Models | WithPreserveReasoningContent (Before) | After | |----------|----------------|--------------------------------------|-------| | DeepSeek | deepseek-reasoner | Yes | Yes | | Kimi | kimi-k2.5, kimi-k2-thinking | Yes | Yes | | OpenAI | o3, o3-pro, o1, gpt-5.2, +15 more | **No** | Yes | | GLM | glm-5, glm-4.7-flashx, +9 more | **No** | Yes | | Qwen | qwq-32b, qwen3-235b-a22b, +20 more | **No** | Yes | ## Test plan - [ ] Verified all three packages compile cleanly: `go build ./pkg/providers/openai/ ./pkg/providers/glm/ ./pkg/providers/qwen/` - [ ] Existing provider tests remain unaffected - [ ] Manual verification: reasoning output should be preserved when using thinking-capable models --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-06 22:09:46 -04:00
yindo closed this issue 2026-06-06 22:09:47 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vxcontrol/pentagi#225