From a56d392cd17277a374a40827cc65c2ef6757a20c Mon Sep 17 00:00:00 2001 From: "andre.liang" Date: Thu, 11 Jul 2024 18:16:44 +0100 Subject: [PATCH] fix: always read the first respond choice --- ai/mistralai/v0/tasks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ai/mistralai/v0/tasks.go b/ai/mistralai/v0/tasks.go index e4667a5ec..7607cf8af 100644 --- a/ai/mistralai/v0/tasks.go +++ b/ai/mistralai/v0/tasks.go @@ -119,7 +119,7 @@ func (e *execution) taskTextGeneration(in *structpb.Struct) (*structpb.Struct, e outputStruct := textGenerationOutput{} - outputStruct.Text = resp.Choices[len(resp.Choices)-1].Message.Content + outputStruct.Text = resp.Choices[0].Message.Content outputStruct.Usage = chatUsage{ InputTokens: resp.Usage.PromptTokens, OutputTokens: resp.Usage.CompletionTokens,