mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-19 10:06:37 +08:00
- Refactor constant definitions and organization - Clean up package level variables and functions - Introduce new `relaymode` and `apitype` packages for constant definitions - Refactor and simplify code in several packages including `openai`, `relay/channel/baidu`, `relay/util`, `relay/controller`, `relay/channeltype` - Add helper functions in `relay/channeltype` package to convert channel type constants to corresponding API type constants - Remove deprecated functions such as `ResponseText2Usage` from `relay/channel/openai/helper.go` - Modify code in `relay/util/validation.go` and related files to use new `validator.ValidateTextRequest` function - Rename `util` package to `relaymode` and update related imports in several packages
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package gemini
|
|
|
|
type ChatRequest struct {
|
|
Contents []ChatContent `json:"contents"`
|
|
SafetySettings []ChatSafetySettings `json:"safety_settings,omitempty"`
|
|
GenerationConfig ChatGenerationConfig `json:"generation_config,omitempty"`
|
|
Tools []ChatTools `json:"tools,omitempty"`
|
|
}
|
|
|
|
type InlineData struct {
|
|
MimeType string `json:"mimeType"`
|
|
Data string `json:"data"`
|
|
}
|
|
|
|
type Part struct {
|
|
Text string `json:"text,omitempty"`
|
|
InlineData *InlineData `json:"inlineData,omitempty"`
|
|
}
|
|
|
|
type ChatContent struct {
|
|
Role string `json:"role,omitempty"`
|
|
Parts []Part `json:"parts"`
|
|
}
|
|
|
|
type ChatSafetySettings struct {
|
|
Category string `json:"category"`
|
|
Threshold string `json:"threshold"`
|
|
}
|
|
|
|
type ChatTools struct {
|
|
FunctionDeclarations any `json:"functionDeclarations,omitempty"`
|
|
}
|
|
|
|
type ChatGenerationConfig struct {
|
|
Temperature float64 `json:"temperature,omitempty"`
|
|
TopP float64 `json:"topP,omitempty"`
|
|
TopK float64 `json:"topK,omitempty"`
|
|
MaxOutputTokens int `json:"maxOutputTokens,omitempty"`
|
|
CandidateCount int `json:"candidateCount,omitempty"`
|
|
StopSequences []string `json:"stopSequences,omitempty"`
|
|
}
|