title: VisionGenerativeModel
type: object
properties:
  sampleCount:
    type: number
    format: int32
    minimum: 1
    description: The number of generated images.
  sampleImageSize:
    type: string
    description: >
      The size of generated images. Supported sizes are:
      64, 256, 512, 1024, 2048 and 4096 for Imagen 2 and 3 models.
      1K, 2K (case-insensitive) for Imagen 4 models.
      Default image size is 1024 for Imagen 2 and 3 models, 1K for Imagen 4 models.
  storageUri:
    type: string
    description: >
      The Google Cloud Storage location for saving the generated images.
    pattern: '^gs:\/\/(.+)\/(.+)$'
  negativePrompt:
    type: string
    description: >
      Negative prompt for helping generate the images.
  seed:
    type: number
    format: int32
    description: The RNG seed.
  mode:
    type: string
    description: Editing mode.
    enum:
    - interactive
    - upscale
    - backgroundEditing
  model:
    type: string
    description: Select the underlying model to do the generation.
    enum:
    - muse
    - imagen
    deprecated: true
  aspectRatio:
    type: string
    description: >
      Optional generation mode parameter that controls aspect ratio. Supported aspect ratios: 1:1, 5:4, 3:2, 7:4, 4:3, 16:9, 9:16.
  guidanceScale:
    type: number
    format: float
    description: >
      Optional editing mode parameter that controls strength of alignment to prompt. 0-9 low strength, 10-20 medium strength, 21+ high strength.
  disablePersonFace:
    type: bool
    description: >
      Whether to disable person/face rai filtering.
    deprecated: true
  enablePersonFaceFilter:
    type: bool
    default: false
    description: >
      Whether to enable person/face rai filtering. Default false.
    deprecated: true
  raiLevel:
    type: number
    format: int32
    description: >
      Level of RAI filtering level. Lower level means more strict filtering set. Currently we have:
      Level 0 (block most)
      Level 1 (block few)
    deprecated: true
  safetySetting:
    type: string
    default: block_medium_and_above
    enum:
    - block_low_and_above
    - block_medium_and_above
    - block_only_high
    - block_none
    - block_most
    - block_some
    - block_few
    - block_fewest
    description: >
      Different safety setting applying various restricness in generating images.
      Case insensitive. Levels are:
        block_low_and_above
        block_medium_and_above
        block_only_high
        block_none
      Depercated labels respectively are:
        block_most
        block_some
        block_few
        block_fewest
  disableChild:
    type: bool
    description: >
      Whether to disable child rai filtering. Only allowlisted user can set this variable. Otherwise, it will be ignored.
    deprecated: true
  enableChildFilter:
    type: bool
    default: true
    description: >
      Whether to enable child rai filtering. Default true. Only allowlisted user can set this variable. Otherwise, it will be ignored.
    deprecated: true
  personGeneration:
    type: string
    default: allow_adult
    enum:
    - dont_allow
    - allow_adult
    - allow_all
    description: >
      Whether allow to generate person images, and restrict to specific ages. Case insensitive.
  sampleImageStyle:
    type: string
    description: Optional style that will be applied to the generated images.
    enum:
    - photograph
    - digital_art
    - landscape
    - sketch
    - watercolor
    - cyberpunk
    - pop_art
  includeRaiReason:
    type: bool
    description: >
      Whether to include reason why generated images are filtered.
  isProductImage:
    type: bool
    description: >
      Whether use self background editing for product images.
  controlNetConfig:
    type: object
    description: Optional configurations for ControlNet conditions.
    properties:
      enableControlNet:
        type: bool
        description: Whether ControlNet is enabled.
      conditions:
        type: array
        description: Configurations for each condition.
        items:
          type: object
          properties:
            conditionName:
              type: string
              description: The name of the condition used.
              enum:
              - cannyEdges
              - depth
            conditionMapBytesBase64Encoded:
              type: string
              description: >
                When the condition map is provided by the user, we will not compute the condition map on our side.
            conditionWeight:
              type: number
              format: float
              minimum: 0.0
              maximum: 1.0
              default: 1.0
              description: >
                The guidance weight for the condition signal. The higher the weight, the model respects the ControlNet condition more.
            conditionMaxT:
              type: number
              format: float
              minimum: 0.0
              maximum: 1.0
              default: 1.0
              description: >
                The strength of the ControlNet's effect on each diffusion step.
      originalImageWeight:
        type: number
        format: float
        minimum: 0.0
        maximum: 1.0
        default: 0.0
        description: >
          The weight for the original image.
          When set to 1.0, the output basically copies the input image.
          When set to 0.0, the output not respect the input image at all.
  controlPluginConfig:
    type: object
    description: Optional configurations for ControlPlugin conditions.
    properties:
      conditions:
        type: array
        description: Configurations for each condition.
        items:
          type: object
          properties:
            conditionName:
              type: string
              description: The name of the condition used.
              enum:
              - scribble
              - cannyEdges
              - scribble-512
            controlScale:
              type: number
              format: float
              minimum: 0.0
              maximum: 1.0
              default: 1.0
              description: >
                Strength of the plugin feature.
            samplingSteps:
              type: integer
              format: int32
              description: Number of steps to take for sampling.
              minimum: 1
              maximum: 150
              default: 150
            computeConditionMap:
              type: bool
              description: >
                When set to true, the system will compute the condition map from the input image,
                otherwise, assumes the input is already a condition map.
            conditionMap:
              type: string
              description: >
                When the condition map is provided by the user, we will not compute the condition map on our side.
  outputOptions:
    type: object
    description: Optional output configurations.
    properties:
      mimeType:
        type: string
        description: Output mime type.
        default: image/png
        enum:
        - image/jpeg
        - image/png
      compressionQuality:
        type: number
        description: Optional compression quality if encoding in image/jpeg.
        format: int32
        default: 75
        minimum: 0
        maximum: 100
  upscaleConfig:
    type: object
    description: Optional upscale configurations.
    properties:
      imagePreservationFactor:
        type: number
        description: >
          With higher image preservation factor, the original image pixels are more respected.
          With a lower image preservation factor, the output image will have be more different from
          the input image, but maybe with finer details and fewer noises.
        format: float
        default: 0.5
        minimum: 0.0
        maximum: 1.0
      enhanceInputImage:
        type: bool
        description: >
          Whether to add an image enhancing step before upscaling.
          It is expected to suppress the noise and JPEG compression artifact from the input image.
        default: false
      enableFasterUpscaling:
        type: bool
        description: >
          NOTE: For experimental use, not production-ready.
          Whether to speed up upscaling. This option can't be used with high QPS since it lowers the
          availability of the upscaling API.
        default: false
      upscaleFactor:
        type: string
        description: >
          The factor to which the image will be upscaled.  If not specified, the
          upscale factor will be determined from the longer side of the input image
          and `sampleImageSize`
        enum:
        - x2
        - x4
  editConfigV6:
    type: object
    description: Optional editing configuration. Only available for imagegeneration@006.
    properties:
      editMode:
        type: string
        description: The editing mode that describes the use case for editing.
        enum:
        - inpainting-remove
        - inpainting-insert
        - outpainting
        - product-image
        default: inpainting-insert
      maskDilation:
        type: float
        default: 0.03
        minimum: 0
        maximum: 1
        description: Dilate (grow) the input mask by the specified percentage of min(width, height).
      guidanceScale:
        type: number
        format: float
        default: 60
        minimum: 1
        maximum: 500
        description: >
          Optional editing mode parameter that controls strength of alignment to prompt.
      productPosition:
        type: string
        description: >
          Controls the product position in the returned product editing images.
        enum:
        - reposition
        - fixed
      maskMode:
        type: object
        description: Configure automatic mask generation.
        properties:
          maskType:
            type: string
            description: >
              The type of mask to generate. Supported values are: background, foreground, semantic.
            enum:
            - background
            - foreground
            - semantic
          classes:
            type: array
            description: >
              The class IDs to use for semantic mask generation. Must be set if mask type is semantic. Maximum of 5 class IDs.
            items:
              type: int32
              minimum: 0
              maximum: 193
      baseSteps:
        type: integer
        format: int32
        description: Number of steps to take for base sampling.
        minimum: 1
        maximum: 150
        default: 75
      backend:
        type: string
        description: >
          The backend to use for the request.
        enum:
        - experimental
        - prod
        default: prod
      semanticFilterConfig:
        type: object
        description: Apply object detection semantic filter on image inpainting area.
        properties:
          enableSemanticFilter:
            type: bool
            default: false
            description: Whether to enable semantic filter feature in image inpainting.
          filterClasses:
            type: array
            description: >
              A list of object class names to apply semantic filter. A class name starts with
              Captialized initial letter, e.g. Person.
            items:
              type: string
          filterEntities:
            type: array
            description: >
              A list of object entity ids to apply semantic filter, e.g. entity id for Person
              is /m/01g317.
            items:
              type: string
          intersectRatioThreshold:
            type: float
            description: >
              A threshold to control semantic fitler strength, the lower the threshold the
              stronger the filter strength.
            minimum: 0
            maximum: 1
          additionalSampleCount:
            type: int32
            description: >
              Additional sample added to the request to improve inpainting success rate.
              However the final number of returned image is the same as sampleCount.
            minimum: 0
            maximum: 4
          semanticFilterMode:
            type: string
            description: >
              A string to specify semantic filter experimental mode. This allows semantic filter
              to change the default behavior to filter generated images.
          detectionScoreThreshold:
            type: float
            description: >
              A detection confidence score threshold to decide which detection boxes
              are considered as the valid detections for semantic filter checking.
            minimum: 0
            maximum: 1
          filterClassesOutpainting:
            type: array
            description: >
              For outpainting case.
              A list of object class names to apply semantic filter. A class name starts with
              Captialized initial letter, e.g. Person.
            items:
              type: string
          filterEntitiesOutpainting:
            type: array
            description: >
              For outpainting case.
              A list of object entity ids to apply semantic filter, e.g. entity id for Person
              is /m/01g317.
            items:
              type: string
          intersectRatioThresholdOutpainting:
            type: float
            description: >
              For outpainting case.
              A threshold to control semantic fitler strength, the lower the threshold the
              stronger the filter strength.
            minimum: 0
            maximum: 1
          detectionScoreThresholdOutpainting:
            type: float
            description: >
              For outpainting case.
              A detection confidence score threshold to decide which detection boxes
              are considered as the valid detections for semantic filter checking.
            minimum: 0
            maximum: 1
          filterClassesSpecialInit:
            type: array
            description: >
              For special_init case.
              A list of object class names to apply semantic filter. A class name starts with
              Captialized initial letter, e.g. Person.
            items:
              type: string
          filterEntitiesSpecialInit:
            type: array
            description: >
              For special_init case.
              A list of object entity ids to apply semantic filter, e.g. entity id for Person
              is /m/01g317.
            items:
              type: string
          intersectRatioThresholdSpecialInit:
            type: float
            description: >
              For special_init case.
              A threshold to control semantic fitler strength, the lower the threshold the
              stronger the filter strength.
            minimum: 0
            maximum: 1
          detectionScoreThresholdSpecialInit:
            type: float
            description: >
              For special_init case.
              A detection confidence score threshold to decide which detection boxes
              are considered as the valid detections for semantic filter checking.
            minimum: 0
            maximum: 1
      alternateInitConfig:
        type: object
        description: Enables an alternate init config to add to return candidates.
        properties:
          enabled:
            type: bool
            default: false
            description: Whether to enable this alternate init config.
          maxInpaintingMaskArea:
            type: float
            default: 0.05
            minimum: 0
            maximum: 1
            description: Only use init config if inpainting mask area / total image area is below this threshold.
      bufferZones:
        type: array
        items:
          type: object
          properties:
            pixels:
              type: int32
              description: Number of pixels to dilate
              minimum: 0
              maximum: 100
            diffusionT:
              type: float
              description: diffusion_t time to do dilation, 1 is start, 0 is end.
              minimum: 0
              maximum: 1
      outpaintingProcessingConfig:
        type: object
        description: Optional outpainting configuration. Only available in imagen-3.0-capability-001.
        properties:
          blendingMode:
            type: string
            description: The blending mode for outpainting.
            enum:
            - alpha-blending
            - pyramid-blending
            default: alpha-blending
          blendingFactor:
            type: float
            description: The blending factor for outpainting.
            minimum: 0
            maximum: 1
            default: 0
  editConfig:
    type: object
    description: Optional editing configuration. Only available in imagegeneration@003.
    properties:
      enableClamping:
        type: bool
        default: false
        description: >
          Whether to enable clamping mode, which:
            * Better preserves unmasked area
            * Skips model internal dilation so client can fully control this
      bufferZones:
        type: array
        items:
          type: object
          properties:
            pixels:
              type: int32
              description: Number of pixels to dilate
              minimum: 0
              maximum: 100
            diffusionT:
              type: float
              description: diffusion_t time to do dilation, 1 is start, 0 is end.
              minimum: 0
              maximum: 1
      baseSteps:
        type: int32
        description: Number of steps to take for base sampling.
        minimum: 1
        maximum: 150
        default: 75
      baseGamma:
        type: float
        description: Gamma, controls noise during base sampling.
        minimum: 0
        maximum: 1
      baseGuidanceScale:
        type: array
        description: List of 4 integers controlling strength of text guidance during base sampling.
        items:
          type: int32
          minimum: 0
          maximum: 200
      sr1Steps:
        type: int32
        description: Number of steps to take for sr1 sampling.
        minimum: 1
        maximum: 4
        default: 4
      sr2Steps:
        type: int32
        description: Number of steps to take for sr2 sampling.
        minimum: 1
        maximum: 2
        default: 2
      semanticFilterConfig:
        type: object
        description: Apply object detection semantic filter on image inpainting area.
        properties:
          enableSemanticFilter:
            type: bool
            default: false
            description: Whether to enable semantic filter feature in image inpainting.
          filterClasses:
            type: array
            description: >
              A list of object class names to apply semantic filter. A class name starts with
              Captialized initial letter, e.g. Person.
            items:
              type: string
          filterEntities:
            type: array
            description: >
              A list of object entity ids to apply semantic filter, e.g. entity id for Person
              is /m/01g317.
            items:
              type: string
          intersectRatioThreshold:
            type: float
            description: >
              A threshold to control semantic fitler strength, the lower the threshold the
              stronger the filter strength.
            minimum: 0
            maximum: 1
          additionalSampleCount:
            type: int32
            description: >
              Additional sample added to the request to improve inpainting success rate.
              However the final number of returned image is the same as sampleCount.
            minimum: 0
            maximum: 4
          semanticFilterMode:
            type: string
            description: >
              A string to specify semantic filter experimental mode. This allows semantic filter
              to change the default behavior to filter generated images.
          detectionScoreThreshold:
            type: float
            description: >
              A detection confidence score threshold to decide which detection boxes
              are considered as the valid detections for semantic filter checking.
            minimum: 0
            maximum: 1
          filterClassesOutpainting:
            type: array
            description: >
              For outpainting case.
              A list of object class names to apply semantic filter. A class name starts with
              Captialized initial letter, e.g. Person.
            items:
              type: string
          filterEntitiesOutpainting:
            type: array
            description: >
              For outpainting case.
              A list of object entity ids to apply semantic filter, e.g. entity id for Person
              is /m/01g317.
            items:
              type: string
          intersectRatioThresholdOutpainting:
            type: float
            description: >
              For outpainting case.
              A threshold to control semantic fitler strength, the lower the threshold the
              stronger the filter strength.
            minimum: 0
            maximum: 1
          detectionScoreThresholdOutpainting:
            type: float
            description: >
              For outpainting case.
              A detection confidence score threshold to decide which detection boxes
              are considered as the valid detections for semantic filter checking.
            minimum: 0
            maximum: 1
          filterClassesSpecialInit:
            type: array
            description: >
              For special_init case.
              A list of object class names to apply semantic filter. A class name starts with
              Captialized initial letter, e.g. Person.
            items:
              type: string
          filterEntitiesSpecialInit:
            type: array
            description: >
              For special_init case.
              A list of object entity ids to apply semantic filter, e.g. entity id for Person
              is /m/01g317.
            items:
              type: string
          intersectRatioThresholdSpecialInit:
            type: float
            description: >
              For special_init case.
              A threshold to control semantic fitler strength, the lower the threshold the
              stronger the filter strength.
            minimum: 0
            maximum: 1
          detectionScoreThresholdSpecialInit:
            type: float
            description: >
              For special_init case.
              A detection confidence score threshold to decide which detection boxes
              are considered as the valid detections for semantic filter checking.
            minimum: 0
            maximum: 1
      experimentUseServoBackend:
        type: bool
        description: >
          NOTE: For experimental use, not production-ready.
          Uses self-hosted Servo model servers for requests instead of SUP.
        default: false
      editMode:
        type: string
        description: The editing mode that describes the use case for editing.
        enum:
        - inpainting-remove
        - inpainting-insert
        - outpainting
        default: inpainting-insert
      alternateInitConfig:
        type: object
        description: Enables an alternate init config to add to return candidates.
        properties:
          enabled:
            type: bool
            default: false
            description: Whether to enable this alternate init config.
          maxInpaintingMaskArea:
            type: float
            default: 0.05
            minimum: 0
            maximum: 1
            description: Only use init config if inpainting mask area / total image area is below this threshold.
      experimentalSrVersion:
        type: string
        description: Experimental flag to adjust version of sr to use. Values subject to change.
        default: ""
      experimentalBaseVersion:
        type: string
        description: Experimental flag to adjust base version. Values subject to change.
        default: ""
      embeddingScale:
        type: float
        default: 0.6
        minimum: 0
        maximum: 1
        description: Controls strength of embedding influence on output image.
      enableBorderReplicatePadding:
        type: bool
        default: false
        deprecated: true
        description: >
          Whether to recompute border replicate padding for input outpainting image.
      enablePostProcessingBlend:
        type: bool
        default: false
        deprecated: true
        description: >
          Whether to add a post-processing blending step for masked editing.
      outpaintingProcessingConfig:
        type: object
        description: Optional outpainting configuration. Only available in imagen-3.0-capability-001.
        properties:
          blendingMode:
            type: string
            description: The blending mode for outpainting.
            enum:
            - alpha-blending
            - pyramid-blending
            default: alpha-blending
          blendingFactor:
            type: float
            description: The blending factor for outpainting.
            minimum: 0
            maximum: 1
            default: 0
          enableBorderReplicatePadding:
            type: bool
            default: false
            description: >
              Whether to recompute border replicate padding for input outpainting image.
          expansionConfig:
            type: object
            description: Optional expansion configuration. Only available in imagen-3.0-capability-001.
            properties:
              top:
                type: int32
                description: Number of pixels to expand the image and mask from the top.
                minimum: 0
                maximum: 500
              bottom:
                type: int32
                description: Number of pixels to expand the image and mask from the bottom.
                minimum: 0
                maximum: 500
              left:
                type: int32
                description: Number of pixels to expand the image and mask from the left.
                minimum: 0
                maximum: 500
              right:
                type: int32
                description: Number of pixels to expand the image and mask from the right.
                minimum: 0
                maximum: 500
      bgswapConfig:
        type: object
        description: Optional background swap configuration. Only available in imagen-3.0-capability-001.
        properties:
          blendingMode:
            type: string
            description: The blending mode for background swap.
            enum:
            - alpha-blending
            default: alpha-blending
          blendingFactor:
            type: float
            description: The blending factor for background swap blending.
            minimum: 0
            maximum: 1
            default: 0
  editMode:
    type: string
    description: The editing mode that describes the use case for editing in Imagen 3 capability.
    enum:
    - EDIT_MODE_DEFAULT
    - EDIT_MODE_INPAINT_REMOVAL
    - EDIT_MODE_INPAINT_INSERTION
    - EDIT_MODE_OUTPAINT
    - EDIT_MODE_CONTROLLED_EDITING
    - EDIT_MODE_STYLE
    - EDIT_MODE_BGSWAP
    - EDIT_MODE_PRODUCT_IMAGE
    default: EDIT_MODE_DEFAULT
  language:
    type: string
    description: Language which the prompts and negative prompts are in.
    enum:
    - auto
    - en
    - ja
    - ko
    - hi
    - zh
    - zh-CN
    - zh-TW
    - es
    - pt
  includeSafetyAttributes:
    type: bool
    description: Whether to include the content safety attributes scores in the response.
  includeDetectedLabels:
    type: bool
    description: Whether to include the detected labels as part of the safety attributes in the response.
  modelVariant:
    type: string
    description: The size variant of the model. Only supported in imagegeneration@004 for now.
    enum:
    - large
    - medium
    - v1_large
    - v1_1
    - v1_1_turbo
  addWatermark:
    type: bool
    description: Whether to add SynthID watermark to the generated image.
  genSelfieConfig:
    type: object
    description: Optional configurations for GenSelfie use cases, which stylizes a selfie image.
    properties:
      identityControl:
        type: number
        format: float
        description: Parameter for identity control.
        default: 0.9
        minimum: 0
        maximum: 1
      structureControl:
        type: number
        format: float
        description: Parameter for structure control.
        default: 1.0
        minimum: 0
        maximum: 1
      perExampleSeeds:
        type: array
        description: >
          Initialization seed per generation sample. `len(seeds)` should be equal to `sampleCount`.
        items:
          type: integer
          format: int32
      experimentalBaseVersion:
        type: string
        description: The version for the base model.. Values subject to change.
        default: ""
      skipFaceCropping:
        type: bool
        description: Whether to skip detecting and cropping the face in the input image.
        default: true
      samplingSteps:
        type: integer
        format: int32
        description: Number of sampling steps.
        minimum: 1
        maximum: 256
      enableSharpening:
        type: bool
        description: Whether to enable image sharpening post-processing.
        default: false
      detectionScoreThreshold:
        type: number
        format: float
        description: >
          The threshold for the face detection model. Images with a face detection score below this
          threshold will be rejected.
        default: 0.5
        minimum: 0
        maximum: 1
      faceSelectionCriteria:
        type: string
        description: The criteria to select the face for Gen Selfie.
        enum:
        - LARGEST
        - MOST_CONFIDENT
      style:
        type: string
        description: The style for the generated image.
        default: watercolor
        enum:
        - watercolor
        - hand-drawing
        - illustration
        - 3d-character
  showRaiErrorCodes:
    type: bool
    default: false
    description: >
      Whether to return rai error codes instead of messages. If not set or is false, the returned
      rai format would depend on the rai filter config for the model.
  enhancePrompt:
    type: bool
    default: false
    description: >
      Whether to use the new prompt rewriting logic.
