Skip to content
1 min read · 147 words

Function: renderOpenAIResponsesMediaBlocks()

ts
function renderOpenAIResponsesMediaBlocks(input: {
  media: Media;
  renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string;
  renderUntrustedContent: (
    content: string,
    attrs: UntrustedContentAttrs,
  ) => string;
  unsupportedMediaPolicy: UnsupportedMediaPolicy;
  warn?: (msg: string) => void;
}): Promise<OpenAIResponsesInputContentBlock[]>;

Defined in: src/batteries/llm/openai_responses/helpers.ts:209

Implements OpenAIResponsesHelpers.renderOpenAIResponsesMediaBlocks.

Parameters

ParameterType
input{ media: Media; renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }
input.mediaMedia
input.renderTrustedContent(content: string, attrs: TrustedContentAttrs) => string
input.renderUntrustedContent(content: string, attrs: UntrustedContentAttrs) => string
input.unsupportedMediaPolicyUnsupportedMediaPolicy
input.warn?(msg: string) => void

Returns

Promise<OpenAIResponsesInputContentBlock[]>

Remarks

image maps to input_image (a data URI). document maps to input_file using the NOW-CONFIRMED file_data: 'data:<mime>;base64,<b64>' shape (a live probe against the real Responses API accepted this exact shape with filename alongside it — see the battery's design notes). audio/video — and any other kind/mime this battery cannot natively express — route through unsupportedMediaPolicy, unchanged.