thinkingBudgetChannelWarning function
- @visibleForTesting
- int? budget,
- BundleSamplerRead read,
- String modelPath
The warning for a thinking budget that caps nothing on the bundle at
modelPath, or null. LiteRT-LM caps the first channel a bundle declares;
when read found none, a turn with thinking on can still think until
maxOutputTokens. Null with no budget, and when the read failed: that read
prints its own warning.
Implementation
@visibleForTesting
String? thinkingBudgetChannelWarning(
int? budget,
BundleSamplerRead read,
String modelPath,
) {
if (budget == null || read.declaresChannel != false) return null;
return '[litertlm_dart] WARNING: '
'LiteRtLmEngine(thinkingTokenBudget: $budget) caps nothing on '
'${modelPath.split(RegExp(r'[/\\]')).last}: the file declares no '
'output channel (LlmMetadata.channels), so a turn with thinking on can '
'still think until maxOutputTokens.';
}