Record Class OpenAiApi.ChatCompletionMessage.MediaContent
java.lang.Object
java.lang.Record
org.springframework.ai.openai.api.OpenAiApi.ChatCompletionMessage.MediaContent
- Record Components:
type
- Content type, each can be of type text or image_url.text
- The text content of the message.imageUrl
- The image content of the message. You can pass multiple images by adding multiple image_url content parts. Image input is only supported when using the gpt-4-visual-preview model.inputAudio
- Audio content part.
- Enclosing class:
- OpenAiApi.ChatCompletionMessage
public static record OpenAiApi.ChatCompletionMessage.MediaContent(String type, String text, OpenAiApi.ChatCompletionMessage.MediaContent.ImageUrl imageUrl, OpenAiApi.ChatCompletionMessage.MediaContent.InputAudio inputAudio)
extends Record
An array of content parts with a defined type. Each MediaContent can be of
either "text", "image_url", or "input_audio" type. Only one option allowed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
Shortcut constructor for an image content.static final record
-
Constructor Summary
ConstructorsConstructorDescriptionMediaContent
(String text) Shortcut constructor for a text content.MediaContent
(String type, String text, OpenAiApi.ChatCompletionMessage.MediaContent.ImageUrl imageUrl, OpenAiApi.ChatCompletionMessage.MediaContent.InputAudio inputAudio) Creates an instance of aMediaContent
record class.Shortcut constructor for an image content.Shortcut constructor for an audio content. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.imageUrl()
Returns the value of theimageUrl
record component.Returns the value of theinputAudio
record component.text()
Returns the value of thetext
record component.final String
toString()
Returns a string representation of this record class.type()
Returns the value of thetype
record component.
-
Constructor Details
-
MediaContent
Shortcut constructor for a text content.- Parameters:
text
- The text content of the message.
-
MediaContent
Shortcut constructor for an image content.- Parameters:
imageUrl
- The image content of the message.
-
MediaContent
Shortcut constructor for an audio content.- Parameters:
inputAudio
- The audio content of the message.
-
MediaContent
public MediaContent(String type, String text, OpenAiApi.ChatCompletionMessage.MediaContent.ImageUrl imageUrl, OpenAiApi.ChatCompletionMessage.MediaContent.InputAudio inputAudio) Creates an instance of aMediaContent
record class.- Parameters:
type
- the value for thetype
record componenttext
- the value for thetext
record componentimageUrl
- the value for theimageUrl
record componentinputAudio
- the value for theinputAudio
record component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
type
Returns the value of thetype
record component.- Returns:
- the value of the
type
record component
-
text
Returns the value of thetext
record component.- Returns:
- the value of the
text
record component
-
imageUrl
Returns the value of theimageUrl
record component.- Returns:
- the value of the
imageUrl
record component
-
inputAudio
Returns the value of theinputAudio
record component.- Returns:
- the value of the
inputAudio
record component
-