Skip to content
1 min read · 158 words

Type Alias: UnsupportedMediaPolicy ​

ts
type UnsupportedMediaPolicy =
  | "throw"
  | "fallback-stash"
  | "synthetic-description"
  | {
      mode: "fallback-stash";
      stashKeys: ReadonlyArray<string>;
    };

Defined in: src/batteries/llm/chat_common/types.ts:283

Policy for how a Chat-family battery handles a @nhtio/adk!Media instance whose modality the wire protocol cannot natively represent.

Remarks ​

The option SHAPE is shared; each battery decides which modalities count as "unsupported" (OpenAI Chat Completions: video; Ollama native /api/chat: everything except image). Three modes:

  • 'throw' — raise the battery's unsupported-media exception and fail the dispatch. Loud failure; the default, so a misconfigured pipeline surfaces immediately.
  • 'fallback-stash' — look for a model-readable text entry in media.stash. If present, render that text inside the appropriate trust envelope in lieu of a media block. If no entry is found, fall through to 'synthetic-description' behaviour. The shorthand string form uses the battery's default key list (['text:transcript', 'text:caption', 'text:description'], walked in order). The object form { mode: 'fallback-stash'; stashKeys } overrides the key list.
  • 'synthetic-description' — always render a synthetic text description constructed from filename, byteLength, and mimeType regardless of stash presence.