Class ModelLibrary

java.lang.Object
eu.svjatoslav.alyverkko_cli.model.ModelLibrary

public class ModelLibrary extends Object
A container (library) for multiple AI models, providing functionality for adding and retrieving models by alias.
  • Constructor Details

    • ModelLibrary

      public ModelLibrary(File modelsBaseDirectory, List<ConfigurationModel> configModels)
      Constructs a library of AI models from the provided list of ConfigurationModels, ignoring those whose paths do not exist.
      Parameters:
      modelsBaseDirectory - the root directory where model files are stored.
      configModels - a list of model configurations.
  • Method Details

    • addModel

      public void addModel(Model model)
      Adds a model to the library if no model with the same alias already exists.
      Parameters:
      model - the model to add.
      Throws:
      RuntimeException - if a model with the same alias already exists.
    • getModels

      public List<Model> getModels()
      Returns:
      the list of loaded models in this library.
    • findModelByAlias

      public Optional<Model> findModelByAlias(String alias)
      Finds a model by its alias in this library.
      Parameters:
      alias - the model alias to look for.
      Returns:
      an Optional describing the found model, or empty if none match.
    • getDefaultModel

      public Model getDefaultModel()
      Returns:
      the default model (first loaded model).
    • printModels

      public void printModels()
      Prints the details of each model in the library to standard output.