GenAI.Media.Router
(GenAI Core v0.3.1)
Copy Markdown
Routes a GenAI.Media.Request to a provider that DECLARES support for its
(input, output) modality (ADR-016 D4 + dmitri N2: an explicit registry, not a
hand-waved candidate set).
Providers register via config :genai, :media_providers, [Mod1, Mod2, ...] — each a
module that implements supported_modalities/0 (and generate_media/2). An explicit
request.provider is validated against its own declared modalities; provider: nil
enumerates the registry and picks the first capable provider.
genai-core owns the modality vocab; providers own their lists — the router never hardcodes a provider's capabilities.
Summary
Functions
@spec registry() :: [module()]
The configured media-capable provider modules.
@spec route(GenAI.Media.Request.t()) :: {:ok, module()} | {:error, :no_provider_for_modality | :provider_unsupported}