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, OpenAiApi.ChatCompletionMessage.MediaContent.InputFile inputFile)
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 recordShortcut constructor for an image content.static final recordstatic final recordConstructor for base64-encoded file -
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, OpenAiApi.ChatCompletionMessage.MediaContent.InputFile inputFile) Creates an instance of aMediaContentrecord class.Shortcut constructor for an image content.Shortcut constructor for an audio content.Shortcut constructor for a file content -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.imageUrl()Returns the value of theimageUrlrecord component.Returns the value of theinputAudiorecord component.Returns the value of theinputFilerecord component.text()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord 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
Shortcut constructor for a file content- Parameters:
inputFile- The file content of the message.
-
MediaContent
public MediaContent(String type, String text, OpenAiApi.ChatCompletionMessage.MediaContent.ImageUrl imageUrl, OpenAiApi.ChatCompletionMessage.MediaContent.InputAudio inputAudio, OpenAiApi.ChatCompletionMessage.MediaContent.InputFile inputFile) Creates an instance of aMediaContentrecord class.- Parameters:
type- the value for thetyperecord componenttext- the value for thetextrecord componentimageUrl- the value for theimageUrlrecord componentinputAudio- the value for theinputAudiorecord componentinputFile- the value for theinputFilerecord 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 thetyperecord component.- Returns:
- the value of the
typerecord component
-
text
Returns the value of thetextrecord component.- Returns:
- the value of the
textrecord component
-
imageUrl
Returns the value of theimageUrlrecord component.- Returns:
- the value of the
imageUrlrecord component
-
inputAudio
Returns the value of theinputAudiorecord component.- Returns:
- the value of the
inputAudiorecord component
-
inputFile
Returns the value of theinputFilerecord component.- Returns:
- the value of the
inputFilerecord component
-