解決 LM Studio gpt-oss 模型輸出參雜「推理內容」之問題

Post Title Image (Photo by Felix Eka Putra Kuntjoro on Unsplash)

起因

剛才想到將 MacWhisper Dictation 的後處理,從原本的 LM Studio google/gemma-3-12b 改成使用 openai/gpt-oss-20b,但一直遇到 gpt-oss 模型會將思考過程也回傳成為 dictation 輸出結果。有問題的輸出結果:

We need to correct punctuation: use full-width. 
Input: "嗨,我們明天去兒童樂園玩好嗎?" 
We replace comma with ,, question mark with ?. 
Also add period at end? 
The sentence ends with question mark already. 
So output: "嗨,我們明天去兒童樂園玩好嗎?"
嗨,我們明天去兒童樂園玩好嗎?


暫時對策

想到可能可以使用 LM Studio Structured Output,但想想邏輯也不對,這樣 MacWhisper 那邊也得看得懂才行。

確認真因

後來 Claude 幫我找到 LM Studio 0.3.9 1 開始支援將推理內容分離到獨立的 reasoning_content 欄位中。

LM Studio settings (LM Studio > App Settings > Developer)

  • 在 LM Studio > App Settings > Developer 中
  • 啟用 “When applicable, separate reasoning_content and content in API responses”。
  • 這樣 API 回應會將思考過程放到 reasoning_content 欄位,主要內容放在 content 欄位

MacWhisper Dictation + LM Studio gpt-oss (螢幕錄影轉成 GIF 居然有點閃爍,就當作個生活紀錄吧。希望不會太傷大家的眼睛。)

搞定,收工。

延伸閱讀