configure method

void configure({
  1. Future<int?> countTokensWithFallback(
    1. List<Map<String, dynamic>>,
    2. List<Map<String, dynamic>>
    )?,
  2. int roughTokenCountEstimation(
    1. String
    )?,
  3. int getEffectiveContextWindowSize(
    1. String
    )?,
  4. int getContextWindowForModel(
    1. String
    )?,
  5. bool isAutoCompactEnabled()?,
  6. ApiUsage? getCurrentUsage(
    1. List<Map<String, dynamic>>
    )?,
  7. void logForDebugging(
    1. String
    )?,
  8. void logError(
    1. Object
    )?,
})

Implementation

void configure({
  Future<int?> Function(
    List<Map<String, dynamic>>,
    List<Map<String, dynamic>>,
  )?
  countTokensWithFallback,
  int Function(String)? roughTokenCountEstimation,
  int Function(String)? getEffectiveContextWindowSize,
  int Function(String)? getContextWindowForModel,
  bool Function()? isAutoCompactEnabled,
  ApiUsage? Function(List<Map<String, dynamic>>)? getCurrentUsage,
  void Function(String)? logForDebugging,
  void Function(Object)? logError,
}) {
  if (countTokensWithFallback != null) {
    _countTokensWithFallback = countTokensWithFallback;
  }
  if (roughTokenCountEstimation != null) {
    _roughTokenCountEstimation = roughTokenCountEstimation;
  }
  if (getEffectiveContextWindowSize != null) {
    _getEffectiveContextWindowSize = getEffectiveContextWindowSize;
  }
  if (getContextWindowForModel != null) {
    _getContextWindowForModel = getContextWindowForModel;
  }
  if (isAutoCompactEnabled != null) {
    _isAutoCompactEnabled = isAutoCompactEnabled;
  }
  if (getCurrentUsage != null) _getCurrentUsage = getCurrentUsage;
  if (logForDebugging != null) _logForDebugging = logForDebugging;
  if (logError != null) _logError = logError;
}