Skip to content

Commit b4bd6fd

Browse files
committed
fix: set missing ali parameters (close songquanpeng#1028)
1 parent e4d928b commit b4bd6fd

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

relay/channel/ali/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ func ConvertRequest(request model.GeneralOpenAIRequest) *ChatRequest {
3333
enableSearch = true
3434
aliModel = strings.TrimSuffix(aliModel, EnableSearchModelSuffix)
3535
}
36+
if request.TopP >= 1 {
37+
request.TopP = 0.9999
38+
}
3639
return &ChatRequest{
3740
Model: aliModel,
3841
Input: Input{
@@ -42,6 +45,9 @@ func ConvertRequest(request model.GeneralOpenAIRequest) *ChatRequest {
4245
EnableSearch: enableSearch,
4346
IncrementalOutput: request.Stream,
4447
Seed: uint64(request.Seed),
48+
MaxTokens: request.MaxTokens,
49+
Temperature: request.Temperature,
50+
TopP: request.TopP,
4551
},
4652
}
4753
}

relay/channel/ali/model.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ type Parameters struct {
1616
Seed uint64 `json:"seed,omitempty"`
1717
EnableSearch bool `json:"enable_search,omitempty"`
1818
IncrementalOutput bool `json:"incremental_output,omitempty"`
19+
MaxTokens int `json:"max_tokens,omitempty"`
20+
Temperature float64 `json:"temperature,omitempty"`
1921
}
2022

2123
type ChatRequest struct {

0 commit comments

Comments
 (0)