diff --git a/relay/channel/ali/main.go b/relay/channel/ali/main.go index b9625584..62115d58 100644 --- a/relay/channel/ali/main.go +++ b/relay/channel/ali/main.go @@ -33,6 +33,9 @@ func ConvertRequest(request model.GeneralOpenAIRequest) *ChatRequest { enableSearch = true aliModel = strings.TrimSuffix(aliModel, EnableSearchModelSuffix) } + if request.TopP >= 1 { + request.TopP = 0.9999 + } return &ChatRequest{ Model: aliModel, Input: Input{ @@ -42,6 +45,9 @@ func ConvertRequest(request model.GeneralOpenAIRequest) *ChatRequest { EnableSearch: enableSearch, IncrementalOutput: request.Stream, Seed: uint64(request.Seed), + MaxTokens: request.MaxTokens, + Temperature: request.Temperature, + TopP: request.TopP, }, } } diff --git a/relay/channel/ali/model.go b/relay/channel/ali/model.go index 54f13041..76e814d1 100644 --- a/relay/channel/ali/model.go +++ b/relay/channel/ali/model.go @@ -16,6 +16,8 @@ type Parameters struct { Seed uint64 `json:"seed,omitempty"` EnableSearch bool `json:"enable_search,omitempty"` IncrementalOutput bool `json:"incremental_output,omitempty"` + MaxTokens int `json:"max_tokens,omitempty"` + Temperature float64 `json:"temperature,omitempty"` } type ChatRequest struct {