Interface AudioContent

All Superinterfaces:
ContentBlock, HasMeta

@Immutable public non-sealed interface AudioContent extends ContentBlock, HasMeta
An audio content block provided to or from an LLM.

The audio data is base64-encoded in data, with the corresponding mimeType describing the encoding (e.g. audio/mp3).

  • Method Details

    • data

      @Redacted String data()
      Returns the base64-encoded audio data.
      Returns:
      the audio data as a base64 string
    • mimeType

      String mimeType()
      Returns the MIME type of the audio content.
      Returns:
      the audio MIME type
    • annotations

      @Nullable Annotations annotations()
      Returns the annotations for this content, or null if none.
      Returns:
      the annotations, or null
    • meta

      @Nullable Map<String,Object> meta()
      Description copied from interface: HasMeta
      Returns the optional metadata map for protocol extensions.
      Specified by:
      meta in interface HasMeta
      Returns:
      the metadata map, or null if none
    • type

      default ContentBlock.Type type()
      Description copied from interface: ContentBlock
      Returns the MCP protocol type discriminator for this content block variant.
      Specified by:
      type in interface ContentBlock
      Returns:
      the content type discriminator
    • check

      @Check default void check()
      Validates that required fields are not blank.
      Throws:
      IllegalArgumentException - if data or mimeType is blank
    • builder

      static AudioContent.Builder builder()
      Creates a new builder for constructing AudioContent instances.
      Returns:
      a new builder
    • base64

      static AudioContent base64(String data, String mimeType)
      Creates an audio content block with no metadata or annotations.
      Parameters:
      data - the base64-encoded audio data
      mimeType - the audio MIME type
      Returns:
      a new audio content
    • of

      @Deprecated(since="1.0.0-beta.15", forRemoval=true) static AudioContent of(String data, String mimeType)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates audio content from base64-encoded data.
      Parameters:
      data - the base64-encoded audio data
      mimeType - the audio MIME type
      Returns:
      a new audio content
    • base64

      static AudioContent base64(String data, String mimeType, @Nullable Annotations annotations)
      Creates an audio content block with given annotations and no metadata.
      Parameters:
      data - the base64-encoded audio data
      mimeType - the audio MIME type
      annotations - the annotations, or null
      Returns:
      a new audio content
    • of

      @Deprecated(since="1.0.0-beta.15", forRemoval=true) static AudioContent of(String data, String mimeType, @Nullable Annotations annotations)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates audio content from base64-encoded data with annotations.
      Parameters:
      data - the base64-encoded audio data
      mimeType - the audio MIME type
      annotations - the annotations, or null
      Returns:
      a new audio content
    • base64

      static AudioContent base64(String data, String mimeType, @Nullable Annotations annotations, @Nullable Map<String,Object> meta)
      Creates an audio content block with metadata and optional annotations.
      Parameters:
      data - the base64-encoded audio data
      mimeType - the audio MIME type
      annotations - the annotations, or null
      meta - the metadata entries, or null
      Returns:
      a new audio content
    • of

      @Deprecated(since="1.0.0-beta.15", forRemoval=true) static AudioContent of(String data, String mimeType, @Nullable Annotations annotations, @Nullable Map<String,Object> meta)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates audio content from base64-encoded data with annotations and metadata.
      Parameters:
      data - the base64-encoded audio data
      mimeType - the audio MIME type
      annotations - the annotations, or null
      meta - the metadata entries, or null
      Returns:
      a new audio content