@@ -342,7 +342,7 @@ func (o *openaiClient) stream(ctx context.Context, messages []message.Message, t
342 slog.Debug("Response", "messages", string(jsonData))
342 slog.Debug("Response", "messages", string(jsonData))
345− if len(acc.ChatCompletion.Choices) == 0 {
345+ if len(acc.Choices) == 0 {
346 eventChan <- ProviderEvent{
346 eventChan <- ProviderEvent{
347 Type: EventError,
347 Type: EventError,
348 Error: fmt.Errorf("received empty streaming response from OpenAI API - check endpoint configuration"),
348 Error: fmt.Errorf("received empty streaming response from OpenAI API - check endpoint configuration"),
@@ -350,7 +350,7 @@ func (o *openaiClient) stream(ctx context.Context, messages []message.Message, t
353− resultFinishReason := acc.ChatCompletion.Choices[0].FinishReason
353+ resultFinishReason := acc.Choices[0].FinishReason
354 if resultFinishReason == "" {
354 if resultFinishReason == "" {
355 // If the finish reason is empty, we assume it was a successful completion
355 // If the finish reason is empty, we assume it was a successful completion
356 // INFO: this is happening for openrouter for some reason
356 // INFO: this is happening for openrouter for some reason