Skip to content

Commit

Permalink
update GeneralOpenAIRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
Calcium-Ion committed Dec 20, 2023
1 parent f5a36a0 commit 45e1042
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion controller/relay-claude.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type ClaudeMetadata struct {
type ClaudeRequest struct {
Model string `json:"model"`
Prompt string `json:"prompt"`
MaxTokensToSample int `json:"max_tokens_to_sample"`
MaxTokensToSample uint `json:"max_tokens_to_sample"`
StopSequences []string `json:"stop_sequences,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
TopP float64 `json:"top_p,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion controller/relay-gemini.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type GeminiChatGenerationConfig struct {
Temperature float64 `json:"temperature,omitempty"`
TopP float64 `json:"topP,omitempty"`
TopK float64 `json:"topK,omitempty"`
MaxOutputTokens int `json:"maxOutputTokens,omitempty"`
MaxOutputTokens uint `json:"maxOutputTokens,omitempty"`
CandidateCount int `json:"candidateCount,omitempty"`
StopSequences []string `json:"stopSequences,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion controller/relay-palm.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type PaLMChatRequest struct {
Temperature float64 `json:"temperature,omitempty"`
CandidateCount int `json:"candidateCount,omitempty"`
TopP float64 `json:"topP,omitempty"`
TopK int `json:"topK,omitempty"`
TopK uint `json:"topK,omitempty"`
}

type PaLMError struct {
Expand Down
2 changes: 1 addition & 1 deletion controller/relay-text.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
}
preConsumedTokens := common.PreConsumedQuota
if textRequest.MaxTokens != 0 {
preConsumedTokens = promptTokens + textRequest.MaxTokens
preConsumedTokens = promptTokens + int(textRequest.MaxTokens)
}
modelRatio := common.GetModelRatio(textRequest.Model)
groupRatio := common.GetGroupRatio(group)
Expand Down
2 changes: 1 addition & 1 deletion controller/relay-xunfei.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type XunfeiChatRequest struct {
Domain string `json:"domain,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
TopK int `json:"top_k,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
MaxTokens uint `json:"max_tokens,omitempty"`
Auditing bool `json:"auditing,omitempty"`
} `json:"chat"`
} `json:"parameter"`
Expand Down
6 changes: 3 additions & 3 deletions controller/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type GeneralOpenAIRequest struct {
Messages []Message `json:"messages,omitempty"`
Prompt any `json:"prompt,omitempty"`
Stream bool `json:"stream,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
MaxTokens uint `json:"max_tokens,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
TopP float64 `json:"top_p,omitempty"`
N int `json:"n,omitempty"`
Expand Down Expand Up @@ -91,14 +91,14 @@ type AudioRequest struct {
type ChatRequest struct {
Model string `json:"model"`
Messages []Message `json:"messages"`
MaxTokens int `json:"max_tokens"`
MaxTokens uint `json:"max_tokens"`
}

type TextRequest struct {
Model string `json:"model"`
Messages []Message `json:"messages"`
Prompt string `json:"prompt"`
MaxTokens int `json:"max_tokens"`
MaxTokens uint `json:"max_tokens"`
//Stream bool `json:"stream"`
}

Expand Down

0 comments on commit 45e1042

Please sign in to comment.