Package org.springframework.ai.openai
Class OpenAiImageModel
java.lang.Object
org.springframework.ai.openai.OpenAiImageModel
- All Implemented Interfaces:
- ImageModel,- Model<ImagePrompt,- ImageResponse> 
OpenAiImageModel is a class that implements the ImageModel interface. It provides a
 client for calling the OpenAI image generation API.
- Since:
- 0.8.0
- Author:
- Mark Pollack, Christian Tzolov, Hyunjoon Choi, Thomas Vitale
- 
Constructor SummaryConstructorsConstructorDescriptionOpenAiImageModel(OpenAiImageApi openAiImageApi) Creates an instance of the OpenAiImageModel.OpenAiImageModel(OpenAiImageApi openAiImageApi, OpenAiImageOptions options, org.springframework.retry.support.RetryTemplate retryTemplate) Initializes a new instance of the OpenAiImageModel.OpenAiImageModel(OpenAiImageApi openAiImageApi, OpenAiImageOptions options, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) Initializes a new instance of the OpenAiImageModel.
- 
Method SummaryModifier and TypeMethodDescriptioncall(ImagePrompt imagePrompt) Executes a method call to the AI model.voidsetObservationConvention(ImageModelObservationConvention observationConvention) Use the provided convention for reporting observation data
- 
Constructor Details- 
OpenAiImageModelCreates an instance of the OpenAiImageModel.- Parameters:
- openAiImageApi- The OpenAiImageApi instance to be used for interacting with the OpenAI Image API.
- Throws:
- IllegalArgumentException- if openAiImageApi is null
 
- 
OpenAiImageModelpublic OpenAiImageModel(OpenAiImageApi openAiImageApi, OpenAiImageOptions options, org.springframework.retry.support.RetryTemplate retryTemplate) Initializes a new instance of the OpenAiImageModel.- Parameters:
- openAiImageApi- The OpenAiImageApi instance to be used for interacting with the OpenAI Image API.
- options- The OpenAiImageOptions to configure the image model.
- retryTemplate- The retry template.
 
- 
OpenAiImageModelpublic OpenAiImageModel(OpenAiImageApi openAiImageApi, OpenAiImageOptions options, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) Initializes a new instance of the OpenAiImageModel.- Parameters:
- openAiImageApi- The OpenAiImageApi instance to be used for interacting with the OpenAI Image API.
- options- The OpenAiImageOptions to configure the image model.
- retryTemplate- The retry template.
- observationRegistry- The ObservationRegistry used for instrumentation.
 
 
- 
- 
Method Details- 
callDescription copied from interface:ModelExecutes a method call to the AI model.- Specified by:
- callin interface- ImageModel
- Specified by:
- callin interface- Model<ImagePrompt,- ImageResponse> 
- Parameters:
- imagePrompt- the request object to be sent to the AI model
- Returns:
- the response from the AI model
 
- 
setObservationConventionUse the provided convention for reporting observation data- Parameters:
- observationConvention- The provided convention
 
 
-