Package org.springframework.ai.openaisdk
Class OpenAiSdkImageModel
java.lang.Object
org.springframework.ai.openaisdk.OpenAiSdkImageModel
- All Implemented Interfaces:
ImageModel,Model<ImagePrompt,ImageResponse>
Image Model implementation using the OpenAI Java SDK.
- Author:
- Julien Dubois
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new OpenAiSdkImageModel with default options.OpenAiSdkImageModel(com.openai.client.OpenAIClient openAIClient) Creates a new OpenAiSdkImageModel with the given OpenAI client.OpenAiSdkImageModel(com.openai.client.OpenAIClient openAIClient, io.micrometer.observation.ObservationRegistry observationRegistry) Creates a new OpenAiSdkImageModel with the given OpenAI client and observation registry.OpenAiSdkImageModel(com.openai.client.OpenAIClient openAIClient, OpenAiSdkImageOptions options) Creates a new OpenAiSdkImageModel with the given OpenAI client and options.OpenAiSdkImageModel(com.openai.client.OpenAIClient openAiClient, OpenAiSdkImageOptions options, io.micrometer.observation.ObservationRegistry observationRegistry) Creates a new OpenAiSdkImageModel with all configuration options.OpenAiSdkImageModel(io.micrometer.observation.ObservationRegistry observationRegistry) Creates a new OpenAiSdkImageModel with the given observation registry.OpenAiSdkImageModel(OpenAiSdkImageOptions options) Creates a new OpenAiSdkImageModel with the given options.OpenAiSdkImageModel(OpenAiSdkImageOptions options, io.micrometer.observation.ObservationRegistry observationRegistry) Creates a new OpenAiSdkImageModel with the given options and observation registry. -
Method Summary
Modifier and TypeMethodDescriptioncall(ImagePrompt imagePrompt) Executes a method call to the AI model.Gets the image options for this model.voidsetObservationConvention(ImageModelObservationConvention observationConvention) Use the provided convention for reporting observation data
-
Constructor Details
-
OpenAiSdkImageModel
public OpenAiSdkImageModel()Creates a new OpenAiSdkImageModel with default options. -
OpenAiSdkImageModel
Creates a new OpenAiSdkImageModel with the given options.- Parameters:
options- the image options
-
OpenAiSdkImageModel
public OpenAiSdkImageModel(io.micrometer.observation.ObservationRegistry observationRegistry) Creates a new OpenAiSdkImageModel with the given observation registry.- Parameters:
observationRegistry- the observation registry
-
OpenAiSdkImageModel
public OpenAiSdkImageModel(OpenAiSdkImageOptions options, io.micrometer.observation.ObservationRegistry observationRegistry) Creates a new OpenAiSdkImageModel with the given options and observation registry.- Parameters:
options- the image optionsobservationRegistry- the observation registry
-
OpenAiSdkImageModel
public OpenAiSdkImageModel(com.openai.client.OpenAIClient openAIClient) Creates a new OpenAiSdkImageModel with the given OpenAI client.- Parameters:
openAIClient- the OpenAI client
-
OpenAiSdkImageModel
public OpenAiSdkImageModel(com.openai.client.OpenAIClient openAIClient, OpenAiSdkImageOptions options) Creates a new OpenAiSdkImageModel with the given OpenAI client and options.- Parameters:
openAIClient- the OpenAI clientoptions- the image options
-
OpenAiSdkImageModel
public OpenAiSdkImageModel(com.openai.client.OpenAIClient openAIClient, io.micrometer.observation.ObservationRegistry observationRegistry) Creates a new OpenAiSdkImageModel with the given OpenAI client and observation registry.- Parameters:
openAIClient- the OpenAI clientobservationRegistry- the observation registry
-
OpenAiSdkImageModel
public OpenAiSdkImageModel(com.openai.client.OpenAIClient openAiClient, OpenAiSdkImageOptions options, io.micrometer.observation.ObservationRegistry observationRegistry) Creates a new OpenAiSdkImageModel with all configuration options.- Parameters:
openAiClient- the OpenAI clientoptions- the image optionsobservationRegistry- the observation registry
-
-
Method Details
-
getOptions
Gets the image options for this model.- Returns:
- the image options
-
call
Description copied from interface:ModelExecutes a method call to the AI model.- Specified by:
callin interfaceImageModel- Specified by:
callin interfaceModel<ImagePrompt,ImageResponse> - Parameters:
imagePrompt- the request object to be sent to the AI model- Returns:
- the response from the AI model
-
setObservationConvention
Use the provided convention for reporting observation data- Parameters:
observationConvention- The provided convention
-