---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/llm/transformers_js/helpers/functions/resolveGenerationOptions.md
---

# Function: resolveGenerationOptions()

```ts
function resolveGenerationOptions(
  canonical: ChatGenerationOptions,
  nativeFallbacks?: {
    enableThinking?: boolean;
    maxTokens?: number;
    multimodal?: {
      audio?: boolean;
      image?: boolean;
    };
    sampler?: ChatSampler;
    seed?: number;
    temperature?: number;
    topK?: number;
    topP?: number;
  },
): ResolvedGenerationOptions;
```

Defined in: [src/batteries/llm/chat\_common/generation.ts:109](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/llm/chat_common/generation.ts#L109)

Resolve the canonical [ChatGenerationOptions](../interfaces/ChatGenerationOptions.md) (already merged across option layers) into a
fully-defaulted [ResolvedGenerationOptions](../interfaces/ResolvedGenerationOptions.md). Native per-battery fallbacks are passed via
`nativeFallbacks` and consulted ONLY when the canonical field is absent (canonical wins). The adapter
then maps the resolved shape onto its runtime API.

## Parameters

| Parameter                           | Type                                                                                                                                                                                                                                                                        | Description                                                                                                                                                           |
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `canonical`                         | [`ChatGenerationOptions`](../interfaces/ChatGenerationOptions.md)                                                                                                                                                                                                           | The canonical fields from the merged adapter options.                                                                                                                 |
| `nativeFallbacks`                   | { `enableThinking?`: `boolean`; `maxTokens?`: `number`; `multimodal?`: { `audio?`: `boolean`; `image?`: `boolean`; }; `sampler?`: [`ChatSampler`](../type-aliases/ChatSampler.md); `seed?`: `number`; `temperature?`: `number`; `topK?`: `number`; `topP?`: `number`; } | Battery-native equivalents to fall back to when a canonical field is unset (e.g. transformers.js `maxNewTokens`, LiteRT `maxOutputTokens`). Each is consulted second. |
| `nativeFallbacks.enableThinking?`   | `boolean`                                                                                                                                                                                                                                                                   | -                                                                                                                                                                     |
| `nativeFallbacks.maxTokens?`        | `number`                                                                                                                                                                                                                                                                    | -                                                                                                                                                                     |
| `nativeFallbacks.multimodal?`       | { `audio?`: `boolean`; `image?`: `boolean`; }                                                                                                                                                                                                                             | -                                                                                                                                                                     |
| `nativeFallbacks.multimodal.audio?` | `boolean`                                                                                                                                                                                                                                                                   | -                                                                                                                                                                     |
| `nativeFallbacks.multimodal.image?` | `boolean`                                                                                                                                                                                                                                                                   | -                                                                                                                                                                     |
| `nativeFallbacks.sampler?`          | [`ChatSampler`](../type-aliases/ChatSampler.md)                                                                                                                                                                                                                             | -                                                                                                                                                                     |
| `nativeFallbacks.seed?`             | `number`                                                                                                                                                                                                                                                                    | -                                                                                                                                                                     |
| `nativeFallbacks.temperature?`      | `number`                                                                                                                                                                                                                                                                    | -                                                                                                                                                                     |
| `nativeFallbacks.topK?`             | `number`                                                                                                                                                                                                                                                                    | -                                                                                                                                                                     |
| `nativeFallbacks.topP?`             | `number`                                                                                                                                                                                                                                                                    | -                                                                                                                                                                     |

## Returns

[`ResolvedGenerationOptions`](../interfaces/ResolvedGenerationOptions.md)
