diff --git a/models.go b/models.go index cb4ef24f..9ff5a7bd 100644 --- a/models.go +++ b/models.go @@ -2093,6 +2093,10 @@ func generateVideosConfigToMldev(fromObject map[string]any, parentObject map[str InternalSetValueByPath(parentObject, []string{"webhookConfig"}, fromWebhookConfig) } + if InternalGetValueByPath(fromObject, []string{"resizeMode"}) != nil { + return nil, fmt.Errorf("resizeMode parameter is not supported in Gemini API") + } + return toObject, nil } @@ -2203,6 +2207,11 @@ func generateVideosConfigToVertex(fromObject map[string]any, parentObject map[st return nil, fmt.Errorf("webhookConfig parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI)") } + fromResizeMode := InternalGetValueByPath(fromObject, []string{"resizeMode"}) + if fromResizeMode != nil { + InternalSetValueByPath(parentObject, []string{"parameters", "resizeMode"}, fromResizeMode) + } + return toObject, nil } diff --git a/types.go b/types.go index 033e7a7e..90ca3b59 100644 --- a/types.go +++ b/types.go @@ -882,6 +882,18 @@ const ( VideoCompressionQualityLossless VideoCompressionQuality = "LOSSLESS" ) +// Resize mode for the image input for video generation. +type ImageResizeMode string + +const ( + // Crop the image to fit the correct aspect ratio (so we lose parts + // of the image in the process). + ImageResizeModeCrop ImageResizeMode = "CROP" + // Pad the image to fit the correct aspect ratio (so we don't lose + // any parts of the image in the process). + ImageResizeModePad ImageResizeMode = "PAD" +) + // Enum representing the tuning method. type TuningMethod string @@ -4504,6 +4516,8 @@ type GenerateVideosConfig struct { // Optional. Webhook configuration for receiving notifications when the // video generation operation completes. WebhookConfig *WebhookConfig `json:"webhookConfig,omitempty"` + // Optional. Resize mode of the image input for video generation. + ResizeMode ImageResizeMode `json:"resizeMode,omitempty"` } // A generated video.