Skip to content
1 min read · 114 words

Function: isEngineContextOverflowMessage()

ts
function isEngineContextOverflowMessage(message: string): boolean;

Defined in: src/batteries/llm/litert_lm/adapter.ts:249

Does this raw engine message report an INPUT context-cap overflow — the prompt's token ids exceed the engine's fixed maxNumTokens? The LiteRT-web runtime throws e.g. Input token ids are too long. Exceeding the maximum number of tokens allowed: 12596 >= 12288. Matched so the raw throw can be translated into the typed E_LITERT_LM_CONTEXT_OVERFLOW instead of the generic stream error — this is the ENGINE BACKSTOP that fires when the optional pre-dispatch guard is unarmed or undercounts. Exported so a host can classify a thrown/caught error the same way.

Parameters

ParameterType
messagestring

Returns

boolean