getEffectiveContextWindowSize function

int getEffectiveContextWindowSize(
  1. String model,
  2. int contextWindow
)

Returns the context window size minus the max output tokens for the model.

Implementation

int getEffectiveContextWindowSize(String model, int contextWindow) {
  final reservedTokens = min(
    _getMaxOutputTokensForModel(model),
    maxOutputTokensForSummary,
  );
  return contextWindow - reservedTokens;
}