Package org.springframework.ai.image
Class ImageResponse
java.lang.Object
org.springframework.ai.image.ImageResponse
- All Implemented Interfaces:
ModelResponse<ImageGeneration>
The image completion (e.g. imageGeneration) response returned by an AI provider.
- Author:
- Mark Pollack, Christian Tzolov, Hyunjoon Choi
-
Constructor Summary
ConstructorDescriptionImageResponse
(List<ImageGeneration> generations) Construct a newImageResponse
instance without metadata.ImageResponse
(List<ImageGeneration> generations, ImageResponseMetadata imageResponseMetadata) Construct a newImageResponse
instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Retrieves the response metadata associated with the AI model's response.Retrieves the result of the AI model.TheList
ofgenerated outputs
.int
hashCode()
toString()
-
Constructor Details
-
ImageResponse
Construct a newImageResponse
instance without metadata.- Parameters:
generations
- theList
ofImageGeneration
returned by the AI provider.
-
ImageResponse
public ImageResponse(List<ImageGeneration> generations, ImageResponseMetadata imageResponseMetadata) Construct a newImageResponse
instance.- Parameters:
generations
- theList
ofImageGeneration
returned by the AI provider.imageResponseMetadata
-ImageResponseMetadata
containing information about the use of the AI provider's API.
-
-
Method Details
-
getResults
TheList
ofgenerated outputs
.It is a
List
oflists
because the Prompt could request multiple outputgenerations
.- Specified by:
getResults
in interfaceModelResponse<ImageGeneration>
- Returns:
- the
List
ofgenerated outputs
.
-
getResult
Description copied from interface:ModelResponse
Retrieves the result of the AI model.- Specified by:
getResult
in interfaceModelResponse<ImageGeneration>
- Returns:
- Returns the first
ImageGeneration
in the generations list.
-
getMetadata
Description copied from interface:ModelResponse
Retrieves the response metadata associated with the AI model's response.- Specified by:
getMetadata
in interfaceModelResponse<ImageGeneration>
- Returns:
- Returns
ImageResponseMetadata
containing information about the use of the AI provider's API.
-
toString
-
equals
-
hashCode
public int hashCode()
-