Jido.Chat.Content.Audio (Jido Chat v1.0.0)

Copy Markdown View Source

Audio content block for messages.

Represents an audio attachment (voice messages, audio files).

Fields

  • url - URL to the audio file (optional if data is provided)
  • data - Base64-encoded audio data (optional if url is provided)
  • media_type - MIME type (e.g., "audio/mp3", "audio/ogg")
  • duration - Duration in seconds (optional)
  • transcript - Text transcript of the audio (optional)

Examples

Audio.new("https://example.com/voice.ogg")
Audio.new("https://example.com/voice.ogg", media_type: "audio/ogg", duration: 15)

Summary

Functions

Creates a new audio content block from base64-encoded data.

Creates a new audio content block from a URL.

Returns the Zoi schema for Audio content

Types

t()

@type t() :: %Jido.Chat.Content.Audio{
  data: nil | nil | binary(),
  duration: nil | nil | integer(),
  media_type: nil | nil | binary(),
  transcript: nil | nil | binary(),
  type: :audio,
  url: nil | nil | binary()
}

Functions

from_base64(data, media_type, opts \\ [])

Creates a new audio content block from base64-encoded data.

new(url, opts \\ [])

Creates a new audio content block from a URL.

Options

  • :media_type - MIME type of the audio
  • :duration - Duration in seconds
  • :transcript - Text transcript

schema()

Returns the Zoi schema for Audio content