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

Copy Markdown View Source

File attachment content block for messages.

Represents a generic file attachment (documents, audio, video, etc.).

Fields

  • url - URL to the file (optional if data is provided)
  • data - Base64-encoded file data (optional if url is provided)
  • media_type - MIME type (e.g., "application/pdf", "audio/mp3")
  • filename - Original filename
  • size - File size in bytes (optional)

Examples

File.new("https://example.com/doc.pdf", "document.pdf")
File.new("https://example.com/doc.pdf", "document.pdf", media_type: "application/pdf")

Summary

Functions

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

Creates a new file content block from a URL.

Returns the Zoi schema for File content

Types

t()

@type t() :: %Jido.Chat.Content.File{
  data: nil | nil | binary(),
  filename: nil | nil | binary(),
  media_type: nil | nil | binary(),
  size: nil | nil | integer(),
  type: :file,
  url: nil | nil | binary()
}

Functions

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

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

Parameters

  • data - Base64-encoded file data
  • filename - Original filename
  • media_type - MIME type
  • opts - Additional options (size)

new(url, filename, opts \\ [])

Creates a new file content block from a URL.

Options

  • :media_type - MIME type of the file
  • :size - File size in bytes

schema()

Returns the Zoi schema for File content