feat: amazon.nova-premier-v1:0

This commit is contained in:
huanghejian
2025-09-11 10:01:54 +08:00
parent f795148c58
commit 2d4ecaaf28
2 changed files with 13 additions and 10 deletions

View File

@@ -20,6 +20,7 @@ var awsModelIDMap = map[string]string{
"amazon.nova-micro-v1:0": "us.amazon.nova-micro-v1:0", "amazon.nova-micro-v1:0": "us.amazon.nova-micro-v1:0",
"amazon.nova-lite-v1:0": "us.amazon.nova-lite-v1:0", "amazon.nova-lite-v1:0": "us.amazon.nova-lite-v1:0",
"amazon.nova-pro-v1:0": "us.amazon.nova-pro-v1:0", "amazon.nova-pro-v1:0": "us.amazon.nova-pro-v1:0",
"amazon.nova-premier-v1:0": "us.amazon.nova-premier-v1:0",
} }
var awsModelCanCrossRegionMap = map[string]map[string]bool{ var awsModelCanCrossRegionMap = map[string]map[string]bool{

View File

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