Class OpenAiImageModel

java.lang.Object
org.springframework.ai.openai.OpenAiImageModel
All Implemented Interfaces:
org.springframework.ai.image.ImageModel, org.springframework.ai.model.Model<org.springframework.ai.image.ImagePrompt,org.springframework.ai.image.ImageResponse>

public class OpenAiImageModel extends Object implements org.springframework.ai.image.ImageModel
Image Model implementation using the OpenAI Java SDK.
Author:
Julien Dubois, Thomas Vitale, Hyunjoon Choi, Christian Tzolov, Mark Pollack, guan xu
  • Constructor Details

    • OpenAiImageModel

      @Deprecated public OpenAiImageModel()
      Deprecated.
      use builder() instead.
      Creates a new OpenAiImageModel with default options.
    • OpenAiImageModel

      @Deprecated public OpenAiImageModel(@Nullable OpenAiImageOptions options)
      Deprecated.
      use builder() instead.
      Creates a new OpenAiImageModel with the given options.
      Parameters:
      options - the image options
    • OpenAiImageModel

      @Deprecated public OpenAiImageModel(@Nullable io.micrometer.observation.ObservationRegistry observationRegistry)
      Deprecated.
      use builder() instead.
      Creates a new OpenAiImageModel with the given observation registry.
      Parameters:
      observationRegistry - the observation registry
    • OpenAiImageModel

      @Deprecated public OpenAiImageModel(@Nullable OpenAiImageOptions options, @Nullable io.micrometer.observation.ObservationRegistry observationRegistry)
      Deprecated.
      use builder() instead.
      Creates a new OpenAiImageModel with the given options and observation registry.
      Parameters:
      options - the image options
      observationRegistry - the observation registry
    • OpenAiImageModel

      @Deprecated public OpenAiImageModel(@Nullable com.openai.client.OpenAIClient openAIClient)
      Deprecated.
      use builder() instead.
      Creates a new OpenAiImageModel with the given OpenAI client.
      Parameters:
      openAIClient - the OpenAI client
    • OpenAiImageModel

      @Deprecated public OpenAiImageModel(@Nullable com.openai.client.OpenAIClient openAIClient, @Nullable OpenAiImageOptions options)
      Deprecated.
      use builder() instead.
      Creates a new OpenAiImageModel with the given OpenAI client and options.
      Parameters:
      openAIClient - the OpenAI client
      options - the image options
    • OpenAiImageModel

      @Deprecated public OpenAiImageModel(@Nullable com.openai.client.OpenAIClient openAIClient, @Nullable io.micrometer.observation.ObservationRegistry observationRegistry)
      Deprecated.
      use builder() instead.
      Creates a new OpenAiImageModel with the given OpenAI client and observation registry.
      Parameters:
      openAIClient - the OpenAI client
      observationRegistry - the observation registry
    • OpenAiImageModel

      @Deprecated public OpenAiImageModel(@Nullable com.openai.client.OpenAIClient openAiClient, @Nullable OpenAiImageOptions options, @Nullable io.micrometer.observation.ObservationRegistry observationRegistry)
      Deprecated.
      use builder() instead.
      Creates a new OpenAiImageModel with all configuration options.
      Parameters:
      openAiClient - the OpenAI client
      options - the image options
      observationRegistry - the observation registry
  • Method Details

    • builder

      public static OpenAiImageModel.Builder builder()
    • getOptions

      public OpenAiImageOptions getOptions()
      Gets the image options for this model.
      Returns:
      the image options
    • call

      public org.springframework.ai.image.ImageResponse call(org.springframework.ai.image.ImagePrompt imagePrompt)
      Specified by:
      call in interface org.springframework.ai.image.ImageModel
      Specified by:
      call in interface org.springframework.ai.model.Model<org.springframework.ai.image.ImagePrompt,org.springframework.ai.image.ImageResponse>
    • setObservationConvention

      public void setObservationConvention(org.springframework.ai.image.observation.ImageModelObservationConvention observationConvention)
      Use the provided convention for reporting observation data
      Parameters:
      observationConvention - The provided convention