Octoroom.Agent.Frame (octoroom_agents v0.1.0)

Copy Markdown View Source

Frames are the structs that processors pass to each other.

Every frame has a category:

  • :system - handled before queued frames and never dropped by an interruption (for example Interruption, VAD events, input audio)
  • :data - delivered in order; dropped by an interruption unless the frame is marked uninterruptible
  • :control - like :data, for markers such as LLMResponseStart

Every frame also has an :id, which the runner sets the first time the frame is pushed.

Define a frame of your own with use Octoroom.Agent.Frame:

defmodule MyApp.Frames.Sentiment do
  use Octoroom.Agent.Frame, category: :data, fields: [:label, score: 0.0]
end

Structs that don't use Octoroom.Agent.Frame can still be pushed; they count as interruptible :data frames.

Summary

Functions

The frame's category: :system, :data or :control.

Defines a frame module nested in the calling module.

True for system frames.

True if the frame is marked uninterruptible. An interruption keeps these frames queued, and doesn't kill tasks started while handling them. (System frames are never dropped either, but tasks started for them are killed.)

Functions

category(struct)

The frame's category: :system, :data or :control.

defframe(name, category, opts \\ [])

(macro)

Defines a frame module nested in the calling module.

defframe Transcription, :data, fields: [:text], uninterruptible: true

system?(frame)

True for system frames.

uninterruptible?(struct)

True if the frame is marked uninterruptible. An interruption keeps these frames queued, and doesn't kill tasks started while handling them. (System frames are never dropped either, but tasks started for them are killed.)