tokenLimit method

  1. @override
Future<int?> tokenLimit({
  1. required int sessionId,
})
override

Total context in tokens, shared by the session's earlier turns, a request and its answer; null where the host cannot report it.

Read for sessionId. The native limits are model-wide and ignore it; the web arm reads that session's contextWindow.

Implementation

@override
Future<int?> tokenLimit({required int sessionId}) async {
  calls.add('tokenLimit');
  _require(sessionId);
  tokenLimitSessionIds.add(sessionId);
  final error = tokenLimitError;
  if (error != null) throw error;
  return tokenLimitResult;
}