|
|
@@ -35,7 +35,7 @@ func copyRequest(req *dto.ClaudeRequest) *AwsClaudeRequest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// Nova模型使用messages-v1格式
|
|
|
+// NovaMessage Nova模型使用messages-v1格式
|
|
|
type NovaMessage struct {
|
|
|
Role string `json:"role"`
|
|
|
Content []NovaContent `json:"content"`
|
|
|
@@ -46,15 +46,17 @@ type NovaContent struct {
|
|
|
}
|
|
|
|
|
|
type NovaRequest struct {
|
|
|
- SchemaVersion string `json:"schemaVersion"`
|
|
|
- Messages []NovaMessage `json:"messages"`
|
|
|
- InferenceConfig NovaInferenceConfig `json:"inferenceConfig,omitempty"`
|
|
|
+ SchemaVersion string `json:"schemaVersion"` // 请求版本,例如 "1.0"
|
|
|
+ Messages []NovaMessage `json:"messages"` // 对话消息列表
|
|
|
+ InferenceConfig *NovaInferenceConfig `json:"inferenceConfig,omitempty"` // 推理配置,可选
|
|
|
}
|
|
|
|
|
|
type NovaInferenceConfig struct {
|
|
|
- MaxTokens int `json:"maxTokens,omitempty"`
|
|
|
- Temperature float64 `json:"temperature,omitempty"`
|
|
|
- TopP float64 `json:"topP,omitempty"`
|
|
|
+ MaxTokens int `json:"maxTokens,omitempty"` // 最大生成的 token 数
|
|
|
+ Temperature float64 `json:"temperature,omitempty"` // 随机性 (默认 0.7, 范围 0-1)
|
|
|
+ TopP float64 `json:"topP,omitempty"` // nucleus sampling (默认 0.9, 范围 0-1)
|
|
|
+ TopK int `json:"topK,omitempty"` // 限制候选 token 数 (默认 50, 范围 0-128)
|
|
|
+ StopSequences []string `json:"stopSequences,omitempty"` // 停止生成的序列
|
|
|
}
|
|
|
|
|
|
// 转换OpenAI请求为Nova格式
|