diff --git a/examples/generate_image.rs b/examples/generate_image.rs index 5343dac..221c40e 100644 --- a/examples/generate_image.rs +++ b/examples/generate_image.rs @@ -1,7 +1,7 @@ use std::{error::Error, io::Cursor}; use gemini_rs::prelude::{ - GeminiClient, PredictImageRequest, PredictImageRequestParameters, + GeminiClient, PersonGeneration, PredictImageRequest, PredictImageRequestParameters, PredictImageRequestParametersOutputOptions, PredictImageRequestPrompt, }; use image::{ImageFormat, ImageReader}; @@ -34,9 +34,13 @@ pub async fn main() -> Result<(), Box> { mime_type: Some("image/jpeg".to_string()), compression_quality: Some(75), }), + person_generation: Some(PersonGeneration::AllowAll), ..Default::default() }, }; + + println!("Request: {:#?}", serde_json::to_string(&request).unwrap()); + let mut result = gemini .predict_image(&request, "imagen-3.0-fast-generate-001") .await?; diff --git a/src/types/predict_image.rs b/src/types/predict_image.rs index 0197351..f0ebe20 100644 --- a/src/types/predict_image.rs +++ b/src/types/predict_image.rs @@ -91,7 +91,7 @@ pub struct PredictImageRequestParameters { /// Supported by the models `imagen-3.0-generate-001`, `imagen-3.0-fast-generate-001`, and /// `imagegeneration@006` only. #[serde(skip_serializing_if = "Option::is_none")] - pub person_generation: Option, + pub person_generation: Option, /// Optional. The language code that corresponds to your text prompt language. /// The following values are supported: @@ -111,14 +111,17 @@ pub struct PredictImageRequestParameters { pub language: Option, /// Adds a filter level to safety filtering. The following values are supported: - /// - `"block_most"`: Strongest filtering level, most strict blocking. - /// - `"block_some"`: Block some problematic prompts and responses. - /// - `"block_few"`: Reduces the number of requests blocked due to safety filters. May - /// increase objectionable content generated by Imagen. - /// - `"block_fewest"`: Block very few problematic prompts and responses. Access to this - /// feature is restricted. /// - /// The default value is `"block_some"`. + /// - "block_low_and_above": Strongest filtering level, most strict blocking. + /// Deprecated value: "block_most". + /// - "block_medium_and_above": Block some problematic prompts and responses. + /// Deprecated value: "block_some". + /// - "block_only_high": Reduces the number of requests blocked due to safety filters. May + /// increase objectionable content generated by Imagen. Deprecated value: "block_few". + /// - "block_none": Block very few problematic prompts and responses. Access to this feature + /// is restricted. Previous field value: "block_fewest". + /// + /// The default value is "block_medium_and_above". /// /// Supported by the models `imagen-3.0-generate-001`, `imagen-3.0-fast-generate-001`, and /// `imagegeneration@006` only. @@ -165,3 +168,11 @@ pub struct PredictImageResponsePrediction { pub bytes_base64_encoded: Vec, pub mime_type: String, } + +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum PersonGeneration { + DontAllow, + AllowAdult, + AllowAll, +}