@@ -345,8 +345,11 @@ func (o *openaiClient) stream(ctx context.Context, messages []message.Message, t
345345 var msgToolCalls []openai.ChatCompletionMessageToolCall
346346 for openaiStream.Next() {
347347 chunk := openaiStream.Current()
348+ if len(chunk.Choices) == 0 {
349+ continue
350+ }
348351 // Kujtim: this is an issue with openrouter qwen, its sending -1 for the tool index
349− if len(chunk.Choices) > 0 && len(chunk.Choices[0].Delta.ToolCalls) > 0 && chunk.Choices[0].Delta.ToolCalls[0].Index == -1 {
352+ if len(chunk.Choices[0].Delta.ToolCalls) > 0 && chunk.Choices[0].Delta.ToolCalls[0].Index == -1 {
350353 chunk.Choices[0].Delta.ToolCalls[0].Index = 0
351354 }
352355 acc.AddChunk(chunk)