Jido.Chat.Media (Jido Chat v1.2.0)

Copy Markdown View Source

Normalized media entry used in Jido.Chat.Incoming.

Explicit provider MIME values are normalized with Jido.Chat.MediaType. Filename and URL hints can recover kind, but they do not add an exact media_type. Adapters can call Jido.Chat.MediaType.resolve/2 when they have stronger provider, response-header, or downloaded-byte evidence.

Summary

Functions

Creates a media struct from map input.

Normalizes supported attachment inputs into a canonical media struct.

Normalizes a list of attachments into canonical media structs.

Returns the Zoi schema for Media.

Types

input()

t()

@type t() :: %Jido.Chat.Media{
  duration: nil | nil | integer(),
  filename: nil | nil | binary(),
  height: nil | nil | integer(),
  kind: :image | :audio | :video | :file,
  media_type: nil | nil | binary(),
  metadata: map(),
  size_bytes: nil | nil | integer(),
  url: nil | nil | binary(),
  width: nil | nil | integer()
}

Functions

new(media)

Creates a media struct from map input.

normalize(media)

@spec normalize(input()) :: t()

Normalizes supported attachment inputs into a canonical media struct.

normalize_many(media)

@spec normalize_many([input()]) :: [t()]

Normalizes a list of attachments into canonical media structs.

schema()

Returns the Zoi schema for Media.