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
ConstructorsConstructorDescriptionImageResponse(List<ImageGeneration> generations) Construct a newImageResponseinstance without metadata.ImageResponse(List<ImageGeneration> generations, ImageResponseMetadata imageResponseMetadata) Construct a newImageResponseinstance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanRetrieves the response metadata associated with the AI model's response.Retrieves the result of the AI model.TheListofgenerated outputs.inthashCode()toString()
-
Constructor Details
-
ImageResponse
Construct a newImageResponseinstance without metadata.- Parameters:
generations- theListofImageGenerationreturned by the AI provider.
-
ImageResponse
public ImageResponse(List<ImageGeneration> generations, ImageResponseMetadata imageResponseMetadata) Construct a newImageResponseinstance.- Parameters:
generations- theListofImageGenerationreturned by the AI provider.imageResponseMetadata-ImageResponseMetadatacontaining information about the use of the AI provider's API.
-
-
Method Details
-
getResults
TheListofgenerated outputs.It is a
Listoflistsbecause the Prompt could request multiple outputgenerations.- Specified by:
getResultsin interfaceModelResponse<ImageGeneration>- Returns:
- the
Listofgenerated outputs.
-
getResult
Description copied from interface:ModelResponseRetrieves the result of the AI model.- Specified by:
getResultin interfaceModelResponse<ImageGeneration>- Returns:
- Returns the first
ImageGenerationin the generations list.
-
getMetadata
Description copied from interface:ModelResponseRetrieves the response metadata associated with the AI model's response.- Specified by:
getMetadatain interfaceModelResponse<ImageGeneration>- Returns:
- Returns
ImageResponseMetadatacontaining information about the use of the AI provider's API.
-
toString
-
equals
-
hashCode
public int hashCode()
-