Class AudioContent

java.lang.Object
dev.langchain4j.data.message.AudioContent
All Implemented Interfaces:
Content

public class AudioContent extends Object implements Content
  • Constructor Details

    • AudioContent

      public AudioContent(URI url)
      Create a new AudioContent from the given url.
      Parameters:
      url - the url of the Audio.
    • AudioContent

      public AudioContent(String url)
      Create a new AudioContent from the given url.
      Parameters:
      url - the url of the Audio.
    • AudioContent

      public AudioContent(String base64Data, String mimeType)
      Create a new AudioContent from the given base64 data and mime type.
      Parameters:
      base64Data - the base64 data of the Audio.
      mimeType - the mime type of the Audio.
    • AudioContent

      public AudioContent(Audio audio)
      Create a new AudioContent from the given Audio.
      Parameters:
      audio - the audio.
  • Method Details

    • type

      public ContentType type()
      Description copied from interface: Content
      Returns the type of content.

      Can be used to cast the content to the correct type.

      Specified by:
      type in interface Content
      Returns:
      The type of content.
    • audio

      public Audio audio()
      Get the Audio.
      Returns:
      the Audio.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • from

      public static AudioContent from(URI url)
      Create a new AudioContent from the given url.
      Parameters:
      url - the url of the Audio.
      Returns:
      the new AudioContent.
    • from

      public static AudioContent from(String url)
      Create a new AudioContent from the given url.
      Parameters:
      url - the url of the Audio.
      Returns:
      the new AudioContent.
    • from

      public static AudioContent from(String base64Data, String mimeType)
      Create a new AudioContent from the given base64 data and mime type.
      Parameters:
      base64Data - the base64 data of the Audio.
      mimeType - the mime type of the Audio.
      Returns:
      the new AudioContent.
    • from

      public static AudioContent from(Audio audio)
      Create a new AudioContent from the given Audio.
      Parameters:
      audio - the Audio.
      Returns:
      the new AudioContent.