---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/llm/transformers_js/type-aliases/MediaOutputExtractorFn.md
description: >-
  Extracts generated media from a battery's raw generation result so the adapter
  can surface it as assistant `Message.attachments`. Injectable + defaulted to
  absent (no media output) on every LLM battery, mirroring the `toolCallParser`
  / `reasoningParser` / `decodeMedia` injection seams.
---

# Type Alias: MediaOutputExtractorFn

```ts
type MediaOutputExtractorFn = (
  result: unknown,
) => GeneratedMediaOutput[] | Promise<GeneratedMediaOutput[]>;
```

Defined in: [src/batteries/llm/chat\_common/types.ts:326](https://github.com/NHTIO/ADK/blob/v1.20261103.0/src/src/batteries/llm/chat_common/types.ts#L326)

Extracts generated media from a battery's raw generation result so the adapter can surface it as
assistant `Message.attachments`. Injectable + defaulted to absent (no media output) on every LLM
battery, mirroring the `toolCallParser` / `reasoningParser` / `decodeMedia` injection seams.

## Parameters

| Parameter | Type      |
| --------- | --------- |
| `result`  | `unknown` |

## Returns

| [`GeneratedMediaOutput`](../../../interfaces/GeneratedMediaOutput.md)\[]
| `Promise`<[`GeneratedMediaOutput`](../../../interfaces/GeneratedMediaOutput.md)\[]>

## Remarks

`result` is the battery-native generation object (transformers.js `model.generate` / pipeline output;
the LiteRT-LM final `Message` + raw content items) — deliberately typed `unknown` because its shape is
battery-specific and the extractor is supplied by whoever wraps a media-emitting model. Returning an
empty array (or not supplying the hook) yields today's text-only behavior, byte-for-byte unchanged.
