Package dev.langchain4j.data.audio
Class Audio
java.lang.Object
dev.langchain4j.data.audio.Audio
Represents audio data that can be used with various AI model implementations.
This class supports multiple formats for storing audio:
- URL: A reference to audio data located at a specific URI
- Binary Data: Raw binary audio data as a byte array, primarily used by implementations like Azure OpenAI
- Base64 Data: Base64 encoded string representation of audio data, primarily used by implementations like OpenAI
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionGet the Base64 encoded string representation of the audio data.byte[]
Get the raw binary data of the audio as a byte array.static Audio.Builder
builder()
Create a newAudio.Builder
.boolean
int
hashCode()
mimeType()
Get the mime type of the audio.toString()
url()
Get the url of the audio.
-
Method Details
-
builder
Create a newAudio.Builder
.- Returns:
- the new
Audio.Builder
.
-
url
Get the url of the audio.- Returns:
- the url of the audio, or null if not set.
-
binaryData
public byte[] binaryData()Get the raw binary data of the audio as a byte array. This format is primarily used by implementations like Azure OpenAI that require raw binary audio data for processing.- Returns:
- the raw binary data of the audio as a byte array, or null if not set.
-
base64Data
Get the Base64 encoded string representation of the audio data. This format is primarily used by implementations like OpenAI that accept Base64 encoded audio data in API requests.- Returns:
- the Base64 encoded string representation of the audio data, or null if not set.
-
mimeType
Get the mime type of the audio.- Returns:
- the mime type of the audio, or null if not set.
-
equals
-
hashCode
public int hashCode() -
toString
-