GenAI.Media.Request (GenAI Core v0.3.2)

Copy Markdown

A media-generation request (ADR-016). The consumer facade GenAI.generate_media/2 takes one of these, the Router picks a provider, and the provider's generate_media/2 fulfils it.

  • prompt - the generation prompt: a string, or content parts (incl. an image part
             for image+text -> image edits).
  • output - the target modality (GenAI.InferenceProviderBehaviour.modality):
             `:image | :speech | :music | :sfx | :video | :document | :text`. Most
             media generation outputs non-text; `:text` covers transcription
             (speech -> text), which also rides this path.
  • input - optional explicit input modality list (e.g. [:speech] for
             transcription). When set, the Router uses it verbatim instead of
             inferring from `prompt`  needed when the source media rides in
             `settings` (e.g. audio bytes) rather than in the prompt.
  • provider - optional explicit provider (module or config-key atom); nil => the
             Router picks by declared capability.
  • model - optional model override (e.g. "gpt-image-1").
  • settings - provider-interpreted knobs (size, quality, voice, duration, audio, ...).
  • api_key - optional per-request key; providers otherwise read their config/env.

Summary

Types

modality()

t()

@type t() :: %GenAI.Media.Request{
  api_key: String.t() | nil,
  input: [modality()] | nil,
  model: String.t() | nil,
  output: modality(),
  prompt: term(),
  provider: module() | atom() | nil,
  settings: map()
}