Class DisabledImageModel

java.lang.Object
dev.langchain4j.model.image.DisabledImageModel
All Implemented Interfaces:
ImageModel

public class DisabledImageModel extends Object implements ImageModel
An ImageModel which throws a ModelDisabledException for all of its methods

This could be used in tests, or in libraries that extend this one to conditionally enable or disable functionality.

  • Constructor Details

    • DisabledImageModel

      public DisabledImageModel()
  • Method Details

    • generate

      public Response<Image> generate(String prompt)
      Description copied from interface: ImageModel
      Given a prompt, generate an image.
      Specified by:
      generate in interface ImageModel
      Parameters:
      prompt - The prompt to generate an image from.
      Returns:
      The generated image Response.
    • generate

      public Response<List<Image>> generate(String prompt, int n)
      Description copied from interface: ImageModel
      Given a prompt, generate n images.

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

      Specified by:
      generate in interface ImageModel
      Parameters:
      prompt - The prompt to generate images from.
      n - The number of images to generate.
      Returns:
      The generated images Response.
    • edit

      public Response<Image> edit(Image image, String prompt)
      Description copied from interface: ImageModel
      Given an existing image, edit this image following the given prompt.
      Specified by:
      edit in interface ImageModel
      Parameters:
      image - The image to be edited.
      prompt - The prompt to edit the image.
      Returns:
      The generated image Response.
    • edit

      public Response<Image> edit(Image image, Image mask, String prompt)
      Description copied from interface: ImageModel
      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.
      Specified by:
      edit in interface ImageModel
      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.