Interface ImageModel

All Known Implementing Classes:
AzureOpenAiImageModel, DisabledImageModel, OpenAiImageModel, VertexAiImageModel, WorkersAiImageModel

public interface ImageModel
Text to Image generator model.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Response<Image>
    edit(Image image, Image mask, String prompt)
    Given an existing image, edit this image following the given prompt and apply the changes only to the part of the image specified by the given mask.
    default Response<Image>
    edit(Image image, String prompt)
    Given an existing image, edit this image following the given prompt.
    generate(String prompt)
    Given a prompt, generate an image.
    default Response<List<Image>>
    generate(String prompt, int n)
    Given a prompt, generate n images.
  • Method Details

    • generate

      Response<Image> generate(String prompt)
      Given a prompt, generate an image.
      Parameters:
      prompt - The prompt to generate an image from.
      Returns:
      The generated image Response.
    • generate

      default Response<List<Image>> generate(String prompt, int n)
      Given a prompt, generate n images.

      Not supported by all models; as explicit support is needed to generate different images from the same prompt.

      Parameters:
      prompt - The prompt to generate images from.
      n - The number of images to generate.
      Returns:
      The generated images Response.
      Throws:
      IllegalArgumentException - if the operation is not supported.
    • edit

      default Response<Image> edit(Image image, String prompt)
      Given an existing image, edit this image following the given prompt.
      Parameters:
      image - The image to be edited.
      prompt - The prompt to edit the image.
      Returns:
      The generated image Response.
    • edit

      default Response<Image> edit(Image image, Image mask, String prompt)
      Given an existing image, edit this image following the given prompt and apply the changes only to the part of the image specified by the given mask.
      Parameters:
      image - The image to be edited.
      mask - The image mask to apply to delimit the area to edit.
      prompt - The prompt to edit the image.
      Returns:
      The generated image Response.