@@ -2,6 +2,7 @@ package provider
22
33import (
44 "context"
5+ "encoding/json"
56 "errors"
67 "fmt"
78 "io"
@@ -348,8 +349,18 @@ func (o *openaiClient) stream(ctx context.Context, messages []message.Message, t
348349 chunk.Choices[0].Delta.ToolCalls[0].Index = 0
349350 }
350351 acc.AddChunk(chunk)
351− // This fixes multiple tool calls for some providers
352352 for i, choice := range chunk.Choices {
353+ reasoning, ok := choice.Delta.JSON.ExtraFields["reasoning"]
354+ if ok && reasoning.Raw() != "" {
355+ reasoningStr := ""
356+ json.Unmarshal([]byte(reasoning.Raw()), &reasoningStr)
357+ if reasoningStr != "" {
358+ eventChan <- ProviderEvent{
359+ Type: EventThinkingDelta,
360+ Thinking: reasoningStr,
361+ }
362+ }
363+ }
353364 if choice.Delta.Content != "" {
354365 eventChan <- ProviderEvent{
355366 Type: EventContentDelta,