Class ModelCache

java.lang.Object
com.codename1.ai.inference.ModelCache

public final class ModelCache extends Object
Downloads large LiteRT models once and exposes the cached file as a ModelSource. Small models can instead be packaged directly with ModelSource.resource(String).
  • Method Details

    • fetch

      public static AsyncResource<ModelSource> fetch(String url, String cacheKey, String sha256)
      Fetches a model into the app-private ai-models directory.
      Parameters:
      url - HTTPS URL of the model
      cacheKey - stable cache name, independent of the URL
      sha256 - optional lowercase or uppercase SHA-256 hex digest
      Returns:
      asynchronous cached model source
    • fetch

      public static AsyncResource<ModelSource> fetch(String url, String cacheKey)