clear method

  1. @override
void clear()
override

Clears the current state of the Llama instance This allows reusing the same instance for a new generation without creating a new instance

Implementation

@override
void clear() {
  if (_isInIsolate == false) {
    send(LlamaLibraryActionType.clear);
    return;
  }

  if (isDeviceSupport() == false || isCrash()) {
    return;
  }

  // Reset the context state
  if (LlamaLibrary._llamaContext.address != 0) {
    LlamaLibrary._llamaLibrarySharedBindingsByGeneralDeveloper
        .llama_kv_cache_clear(LlamaLibrary._llamaContext);
  }
}