29 lines
1.3 KiB
Go
29 lines
1.3 KiB
Go
package request
|
|
|
|
// ChatCompletionRequest OpenAI兼容的聊天请求
|
|
type ChatCompletionRequest struct {
|
|
Model string `json:"model"`
|
|
Messages []ChatMessage `json:"messages"`
|
|
Temperature *float64 `json:"temperature,omitempty"`
|
|
TopP *float64 `json:"top_p,omitempty"`
|
|
N *int `json:"n,omitempty"`
|
|
Stream bool `json:"stream,omitempty"`
|
|
Stop interface{} `json:"stop,omitempty"`
|
|
MaxTokens *int `json:"max_tokens,omitempty"`
|
|
PresencePenalty *float64 `json:"presence_penalty,omitempty"`
|
|
FrequencyPenalty *float64 `json:"frequency_penalty,omitempty"`
|
|
LogitBias map[string]float64 `json:"logit_bias,omitempty"`
|
|
User string `json:"user,omitempty"`
|
|
|
|
// 扩展字段 - 用于指定预设和提供商
|
|
PresetName string `json:"preset_name,omitempty"` // 预设名称
|
|
ProviderName string `json:"provider_name,omitempty"` // 提供商名称
|
|
BindingName string `json:"binding_name,omitempty"` // 绑定名称(优先级最高)
|
|
}
|
|
|
|
type ChatMessage struct {
|
|
Role string `json:"role"` // system, user, assistant
|
|
Content string `json:"content"`
|
|
Name string `json:"name,omitempty"`
|
|
}
|