Function: renderMediaToLiteRtContent()
ts
function renderMediaToLiteRtContent(input: {
media: Media;
modalityEnabled: boolean;
nonce: string;
renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string;
renderUntrustedContent: (
content: string,
attrs: UntrustedContentAttrs,
) => string;
unsupportedMediaPolicy: UnsupportedMediaPolicy;
warn?: (msg: string) => void;
}): Promise<MessageContentItem[]>;Defined in: src/batteries/llm/litert_lm/helpers.ts:208
Render a media kind/mime/filename into a LiteRT content item, or fall back per unsupportedMediaPolicy.
Parameters
| Parameter | Type |
|---|---|
input | { media: Media; modalityEnabled: boolean; nonce: string; renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; } |
input.media | Media |
input.modalityEnabled | boolean |
input.nonce | string |
input.renderTrustedContent | (content: string, attrs: TrustedContentAttrs) => string |
input.renderUntrustedContent | (content: string, attrs: UntrustedContentAttrs) => string |
input.unsupportedMediaPolicy | UnsupportedMediaPolicy |
input.warn? | (msg: string) => void |
Returns
Promise<MessageContentItem[]>
Remarks
The preview .litertlm models are text-in/text-out, and the exact multimodal content-item wire shape is not yet stable in the published types. This maps image/audio/document/video to a best-effort { type, path }-style item when the matching modality flag is enabled, and otherwise degrades through the shared unsupportedMediaPolicy (stash text / synthetic description / throw). Verify the content-item shape against the installed .d.ts + a real multimodal model before relying on the native path.