fixes #1051: handle openai presence and request penalty parameters (#1817)

* fix request debugging, disable marshalling of context fields

Signed-off-by: blob42 <contact@blob42.xyz>

* merge frequency_penalty request parm with config

Signed-off-by: blob42 <contact@blob42.xyz>

* openai: add presence_penalty parameter

Signed-off-by: blob42 <contact@blob42.xyz>

---------

Signed-off-by: blob42 <contact@blob42.xyz>
This commit is contained in:
Chakib Benziane 2024-03-17 09:43:20 +01:00 committed by GitHub
parent 8967ed1601
commit 801b481beb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 1 deletions

View File

@ -185,6 +185,14 @@ func updateRequestConfig(config *config.BackendConfig, input *schema.OpenAIReque
config.RepeatPenalty = input.RepeatPenalty config.RepeatPenalty = input.RepeatPenalty
} }
if input.FrequencyPenalty!= 0 {
config.FrequencyPenalty = input.FrequencyPenalty
}
if input.PresencePenalty!= 0 {
config.PresencePenalty = input.PresencePenalty
}
if input.Keep != 0 { if input.Keep != 0 {
config.Keep = input.Keep config.Keep = input.Keep
} }

View File

@ -108,7 +108,7 @@ type ChatCompletionResponseFormat struct {
type OpenAIRequest struct { type OpenAIRequest struct {
PredictionOptions PredictionOptions
Context context.Context `json:"-"` Context context.Context `json:"-"`
Cancel context.CancelFunc `json:"-"` Cancel context.CancelFunc `json:"-"`
// whisper // whisper

View File

@ -25,6 +25,7 @@ type PredictionOptions struct {
Keep int `json:"n_keep" yaml:"n_keep"` Keep int `json:"n_keep" yaml:"n_keep"`
FrequencyPenalty float64 `json:"frequency_penalty" yaml:"frequency_penalty"` FrequencyPenalty float64 `json:"frequency_penalty" yaml:"frequency_penalty"`
PresencePenalty float64 `json:"presence_penalty" yaml:"presence_penalty"`
TFZ float64 `json:"tfz" yaml:"tfz"` TFZ float64 `json:"tfz" yaml:"tfz"`
TypicalP float64 `json:"typical_p" yaml:"typical_p"` TypicalP float64 `json:"typical_p" yaml:"typical_p"`