cancelTextGeneration method

void cancelTextGeneration()

Cancel ongoing text generation.

Implementation

void cancelTextGeneration() {
  if (_handle == null || _backendType != 'llamacpp') return;

  try {
    final cancel = _lib.lookupFunction<RacLlmComponentCancelNative,
        RacLlmComponentCancelDart>('rac_llm_component_cancel');
    cancel(_handle!);
  } catch (_) {
    // Ignore errors
  }
}