Class Adapters

java.lang.Object
smile.onnx.genai.Adapters
All Implemented Interfaces:
AutoCloseable

public final class Adapters extends Object implements AutoCloseable
Container for LoRA adapters that can be activated on a Generator.
  • Method Details

    • of

      public static Adapters of(Model model)
      Creates an adapters container for the given model.
      Parameters:
      model - the model.
      Returns:
      adapters owned by the caller.
    • load

      public Adapters load(String adapterFilePath, String adapterName)
      Loads an adapter from disk under a caller-chosen name.
      Parameters:
      adapterFilePath - path to the adapter file.
      adapterName - unique name used later with Generator.setActiveAdapter(Adapters, String).
      Returns:
      this for chaining.
    • unload

      public Adapters unload(String adapterName)
      Unloads a previously loaded adapter.
      Parameters:
      adapterName - adapter name.
      Returns:
      this for chaining.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable