From ad5162750e90a4b00f036097f5d69853cc61e523 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Tue, 17 Mar 2026 14:35:11 -0300 Subject: [PATCH] fix: address kronk api change --- providers/kronk/language_model.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/providers/kronk/language_model.go b/providers/kronk/language_model.go index 07f76c58a90f2ab268ecb22efb530d8fa9449737..dba0adce80182da7490845195c0badb066256991 100644 --- a/providers/kronk/language_model.go +++ b/providers/kronk/language_model.go @@ -168,27 +168,27 @@ func (l *languageModel) Generate(ctx context.Context, call fantasy.Call) (*fanta for resp := range ch { lastResponse = resp - if len(resp.Choice) > 0 && resp.Choice[0].Delta != nil { - switch resp.Choice[0].FinishReason() { + if len(resp.Choices) > 0 && resp.Choices[0].Delta != nil { + switch resp.Choices[0].FinishReason() { case model.FinishReasonError: - return nil, &fantasy.Error{Title: "model error", Message: resp.Choice[0].Delta.Content} + return nil, &fantasy.Error{Title: "model error", Message: resp.Choices[0].Delta.Content} case model.FinishReasonStop, model.FinishReasonTool: // Final response already contains full accumulated content in Delta.Content, // so we use it directly instead of continuing to accumulate. - fullContent = resp.Choice[0].Delta.Content + fullContent = resp.Choices[0].Delta.Content default: - fullContent += resp.Choice[0].Delta.Content + fullContent += resp.Choices[0].Delta.Content } } } - if len(lastResponse.Choice) == 0 { + if len(lastResponse.Choices) == 0 { return nil, &fantasy.Error{Title: "no response", Message: "no response generated"} } - choice := lastResponse.Choice[0] + choice := lastResponse.Choices[0] var content []fantasy.Content if choice.Delta != nil { content = make([]fantasy.Content, 0, 1+len(choice.Delta.ToolCalls)) @@ -286,11 +286,11 @@ func (l *languageModel) Stream(ctx context.Context, call fantasy.Call) (fantasy. toolIndex := 0 for resp := range ch { - if len(resp.Choice) == 0 { + if len(resp.Choices) == 0 { continue } - choice := resp.Choice[0] + choice := resp.Choices[0] if choice.Delta == nil { continue }