pub struct ImageGenerateParams {
pub prompt: String,
pub negative_prompt: Option<String>,
pub model: String,
pub aspect_ratio: String,
pub number_of_images: u8,
pub seed: Option<i64>,
pub output_file: Option<String>,
pub output_uri: Option<String>,
}Expand description
Text-to-image generation parameters.
These parameters control the image generation process via the Vertex AI Imagen API.
Fields§
§prompt: StringText prompt describing the image to generate. Maximum length depends on the model (480 chars for Imagen 3, 2000 for Imagen 4).
negative_prompt: Option<String>Negative prompt - what to avoid in the generated image.
model: StringModel to use for generation. Defaults to “imagen-4.0-generate-preview-05-20”.
aspect_ratio: StringAspect ratio for the generated image. Valid values: “1:1”, “3:4”, “4:3”, “9:16”, “16:9”.
number_of_images: u8Number of images to generate (1-4).
seed: Option<i64>Random seed for reproducible generation.
output_file: Option<String>Output file path for saving the image locally. If not specified and output_uri is not specified, returns base64-encoded data.
output_uri: Option<String>Output storage URI (e.g., gs://bucket/path). If specified, uploads the image to the storage backend.
Implementations§
Source§impl ImageGenerateParams
impl ImageGenerateParams
Sourcepub fn validate(&self) -> Result<(), Vec<ValidationError>>
pub fn validate(&self) -> Result<(), Vec<ValidationError>>
Validate the parameters against the model constraints.
§Returns
Ok(())if all parameters are validErr(Vec<ValidationError>)with all validation errors
Sourcepub fn get_model(&self) -> Option<&'static ImagenModel>
pub fn get_model(&self) -> Option<&'static ImagenModel>
Get the resolved model definition.
Trait Implementations§
Source§impl Clone for ImageGenerateParams
impl Clone for ImageGenerateParams
Source§fn clone(&self) -> ImageGenerateParams
fn clone(&self) -> ImageGenerateParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ImageGenerateParams
impl Debug for ImageGenerateParams
Source§impl<'de> Deserialize<'de> for ImageGenerateParams
impl<'de> Deserialize<'de> for ImageGenerateParams
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<ImageGenerateToolParams> for ImageGenerateParams
impl From<ImageGenerateToolParams> for ImageGenerateParams
Source§fn from(params: ImageGenerateToolParams) -> Self
fn from(params: ImageGenerateToolParams) -> Self
Source§impl JsonSchema for ImageGenerateParams
impl JsonSchema for ImageGenerateParams
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for ImageGenerateParams
impl RefUnwindSafe for ImageGenerateParams
impl Send for ImageGenerateParams
impl Sync for ImageGenerateParams
impl Unpin for ImageGenerateParams
impl UnsafeUnpin for ImageGenerateParams
impl UnwindSafe for ImageGenerateParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request