Class ModelLibrary
java.lang.Object
eu.svjatoslav.alyverkko_cli.model.ModelLibrary
A container (library) for multiple AI models, providing
functionality for adding and retrieving models by alias.
-
Constructor Summary
ConstructorsConstructorDescriptionModelLibrary(File modelsBaseDirectory, List<ConfigurationModel> configModels) Constructs a library of AI models from the provided list ofConfigurationModels, ignoring those whose paths do not exist. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a model to the library if no model with the same alias already exists.findModelByAlias(String alias) Finds a model by its alias in this library.voidPrints the details of each model in the library to standard output.
-
Constructor Details
-
ModelLibrary
Constructs a library of AI models from the provided list ofConfigurationModels, 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
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
- Returns:
- the list of loaded models in this library.
-
findModelByAlias
Finds a model by its alias in this library.- Parameters:
alias- the model alias to look for.- Returns:
- an
Optionaldescribing the found model, or empty if none match.
-
getDefaultModel
- Returns:
- the default model (first loaded model).
-
printModels
public void printModels()Prints the details of each model in the library to standard output.
-