Skip to content

Commit a3c7f0e

Browse files
committed
feat: enable reasoning content fallback and remove rejection
- Remove error handling that rejected reasoning content, allowing its use - Add fallback logic to populate response content with ReasoningContent when primary content is empty - Update comment to indicate support for reasoning models with a preference for Content first Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
1 parent e33583a commit a3c7f0e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

provider/openai/openai.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ func (c *Client) completion(
176176
if len(r.Choices) == 0 {
177177
return nil, fmt.Errorf("no choices returned from API")
178178
}
179-
// Do not support reasoning content for now.
180-
if r.Choices[0].Message.ReasoningContent != "" {
181-
return nil, fmt.Errorf("reasoning model is not supported")
182-
}
179+
// Support reasoning models: prefer Content, fallback to ReasoningContent if empty
183180
resp.Content = r.Choices[0].Message.Content
181+
if resp.Content == "" && r.Choices[0].Message.ReasoningContent != "" {
182+
resp.Content = r.Choices[0].Message.ReasoningContent
183+
}
184184
resp.Usage = r.Usage
185185
return resp, nil
186186
}

0 commit comments

Comments
 (0)