mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-19 04:37:53 +00:00
feat: support stopwords both string and arrays (#154)
This commit is contained in:
parent
0b226ac027
commit
70caf9bf8c
@ -63,7 +63,7 @@ type OpenAIRequest struct {
|
||||
Instruction string `json:"instruction" yaml:"instruction"`
|
||||
Input string `json:"input" yaml:"input"`
|
||||
|
||||
Stop []string `json:"stop" yaml:"stop"`
|
||||
Stop interface{} `json:"stop" yaml:"stop"`
|
||||
|
||||
// Messages is read only by chat/completion API calls
|
||||
Messages []Message `json:"messages" yaml:"messages"`
|
||||
@ -117,8 +117,12 @@ func updateConfig(config *Config, input *OpenAIRequest) {
|
||||
config.Maxtokens = input.Maxtokens
|
||||
}
|
||||
|
||||
if len(input.Stop) != 0 {
|
||||
config.StopWords = append(config.StopWords, input.Stop...)
|
||||
switch stop := input.Stop.(type) {
|
||||
case string:
|
||||
config.StopWords = append(config.StopWords, stop)
|
||||
case []string:
|
||||
config.StopWords = append(config.StopWords, stop...)
|
||||
|
||||
}
|
||||
|
||||
if input.RepeatPenalty != 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user