From 80a7205d2d915fe5226e8e616630adc2bdd4afc4 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Mon, 1 May 2023 19:41:02 -0400 Subject: [PATCH] experimental: just force it to be a string array in all cases since OpenAI expects either a string or string array. --- api/openai.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/openai.go b/api/openai.go index 80322eb0..143a9499 100644 --- a/api/openai.go +++ b/api/openai.go @@ -62,7 +62,7 @@ type OpenAIRequest struct { Instruction string `json:"instruction" yaml:"instruction"` Input string `json:"input" yaml:"input"` - Stop string `json:"stop" yaml:"stop"` + Stop []string `json:"stop" yaml:"stop"` // Messages is read only by chat/completion API calls Messages []Message `json:"messages" yaml:"messages"` @@ -116,8 +116,8 @@ func updateConfig(config *Config, input *OpenAIRequest) { config.Maxtokens = input.Maxtokens } - if input.Stop != "" { - config.StopWords = append(config.StopWords, input.Stop) + if len(input.Stop) != 0 { + config.StopWords = append(config.StopWords, input.Stop...) } if input.RepeatPenalty != 0 {