LLM for Unity
v2.3.0
Create characters in Unity with LLMs!
|
Class implementing the LLM model manager. More...
Static Public Member Functions | |
static void | SetDownloadProgress (float progress) |
Sets the model download progress in all registered callbacks. | |
static Task< bool > | Setup () |
Setup of the models. | |
static async Task< bool > | SetupOnce () |
Task performing the setup of the models. | |
static void | SetTemplate (string filename, string chatTemplate) |
Sets the chat template for a model and distributes it to all LLMs using it. | |
static void | SetTemplate (ModelEntry entry, string chatTemplate) |
Sets the chat template for a model and distributes it to all LLMs using it. | |
static ModelEntry | Get (string path) |
Gets the model entry for a model path. | |
static string | GetAssetPath (string filename) |
Gets the asset path based on whether the application runs locally in the editor or in a build. | |
static int | Num (bool lora) |
Returns the number of LLM/LORA models. | |
static int | NumModels () |
Returns the number of LLM models. | |
static int | NumLoras () |
Returns the number of LORA models. | |
static void | Register (LLM llm) |
Registers a LLM to the model manager. | |
static void | Unregister (LLM llm) |
Removes a LLM from the model manager. | |
static void | LoadFromDisk () |
Loads the model manager from a file. | |
static string | AddEntry (ModelEntry entry) |
Adds a model entry to the model manager. | |
static string | AddEntry (string path, bool lora=false, string label=null, string url=null) |
Creates and adds a model entry to the model manager. | |
static async Task< string > | Download (string url, bool lora=false, bool log=false, string label=null) |
Downloads a model and adds a model entry to the model manager. | |
static string | Load (string path, bool lora=false, bool log=false, string label=null) |
Loads a model from disk and adds a model entry to the model manager. | |
static async Task< string > | DownloadModel (string url, bool log=false, string label=null) |
Downloads a LLM model from disk and adds a model entry to the model manager. | |
static async Task< string > | DownloadLora (string url, bool log=false, string label=null) |
Downloads a Lora model from disk and adds a model entry to the model manager. | |
static string | LoadModel (string path, bool log=false, string label=null) |
Loads a LLM model from disk and adds a model entry to the model manager. | |
static string | LoadLora (string path, bool log=false, string label=null) |
Loads a LORA model from disk and adds a model entry to the model manager. | |
static void | SetURL (string filename, string url) |
Sets the URL for a model. | |
static void | SetURL (ModelEntry entry, string url) |
Sets the URL for a model. | |
static void | SetIncludeInBuild (string filename, bool includeInBuild) |
Sets whether to include a model to the build. | |
static void | SetIncludeInBuild (ModelEntry entry, bool includeInBuild) |
Sets whether to include a model to the build. | |
static void | SetDownloadOnStart (bool value) |
Sets whether to download files on start. | |
static void | Remove (string filename) |
Removes a model from the model manager. | |
static void | Remove (ModelEntry entry) |
Removes a model from the model manager. | |
static void | SetModelProgress (float progress) |
Sets the LLM download progress. | |
static void | SetLoraProgress (float progress) |
Sets the LORA download progress. | |
static void | Save () |
Serialises and saves the model manager. | |
static void | Load () |
Deserialises and loads the model manager. | |
static void | SaveToDisk () |
Saves the model manager to disk for the build. | |
static void | Build (ActionCallback copyCallback) |
Saves the model manager to disk along with models that are not (or can't) be downloaded for the build. | |
Static Public Attributes | |
static bool | downloadOnStart = false |
static List< ModelEntry > | modelEntries = new List<ModelEntry>() |
static float | downloadProgress = 1 |
static List< Callback< float > > | downloadProgressCallbacks = new List<Callback<float>>() |
static float | modelProgress = 1 |
static float | loraProgress = 1 |
Class implementing the LLM model manager.
Definition at line 108 of file LLMManager.cs.
|
inlinestatic |
Adds a model entry to the model manager.
entry | model entry |
Definition at line 345 of file LLMManager.cs.
|
inlinestatic |
Creates and adds a model entry to the model manager.
path | model path |
lora | if it is a LORA or LLM |
label | label to show in the model manager in the Editor |
url | model url |
Definition at line 376 of file LLMManager.cs.
|
inlinestatic |
Saves the model manager to disk along with models that are not (or can't) be downloaded for the build.
copyCallback | copy function |
Definition at line 648 of file LLMManager.cs.
|
inlinestatic |
Downloads a model and adds a model entry to the model manager.
url | model url |
lora | if it is a LORA or LLM |
log | whether to log |
label | model label |
Definition at line 389 of file LLMManager.cs.
|
inlinestatic |
Downloads a Lora model from disk and adds a model entry to the model manager.
url | model url |
log | whether to log |
label | model label |
Definition at line 472 of file LLMManager.cs.
|
inlinestatic |
Downloads a LLM model from disk and adds a model entry to the model manager.
url | model url |
log | whether to log |
label | model label |
Definition at line 460 of file LLMManager.cs.
|
inlinestatic |
Gets the model entry for a model path.
path | model path |
Definition at line 239 of file LLMManager.cs.
|
inlinestatic |
Gets the asset path based on whether the application runs locally in the editor or in a build.
filename | model filename or relative path |
Definition at line 255 of file LLMManager.cs.
|
inlinestatic |
Deserialises and loads the model manager.
Definition at line 620 of file LLMManager.cs.
|
inlinestatic |
Loads a model from disk and adds a model entry to the model manager.
path | model path |
lora | if it is a LORA or LLM |
log | whether to log |
label | model label |
Definition at line 442 of file LLMManager.cs.
|
inlinestatic |
Loads the model manager from a file.
Definition at line 320 of file LLMManager.cs.
|
inlinestatic |
Loads a LORA model from disk and adds a model entry to the model manager.
path | model path |
log | whether to log |
label | model label |
Definition at line 496 of file LLMManager.cs.
|
inlinestatic |
Loads a LLM model from disk and adds a model entry to the model manager.
path | model path |
log | whether to log |
label | model label |
Definition at line 484 of file LLMManager.cs.
|
inlinestatic |
Returns the number of LLM/LORA models.
lora | whether to return number of LORA or LLM models |
Definition at line 271 of file LLMManager.cs.
|
inlinestatic |
Returns the number of LORA models.
Definition at line 294 of file LLMManager.cs.
|
inlinestatic |
Returns the number of LLM models.
Definition at line 285 of file LLMManager.cs.
|
inlinestatic |
Registers a LLM to the model manager.
llm | LLM |
Definition at line 303 of file LLMManager.cs.
|
inlinestatic |
Removes a model from the model manager.
filename | model entry |
Definition at line 577 of file LLMManager.cs.
|
inlinestatic |
Removes a model from the model manager.
filename | model filename |
Definition at line 568 of file LLMManager.cs.
|
inlinestatic |
Serialises and saves the model manager.
Definition at line 610 of file LLMManager.cs.
|
inlinestatic |
Saves the model manager to disk for the build.
Definition at line 632 of file LLMManager.cs.
|
inlinestatic |
Sets whether to download files on start.
value | whether to download files |
Definition at line 549 of file LLMManager.cs.
|
inlinestatic |
Sets the model download progress in all registered callbacks.
progress | model download progress |
Definition at line 126 of file LLMManager.cs.
|
inlinestatic |
Sets whether to include a model to the build.
entry | model entry |
includeInBuild | whether to include it |
Definition at line 538 of file LLMManager.cs.
|
inlinestatic |
Sets whether to include a model to the build.
filename | model filename |
includeInBuild | whether to include it |
Definition at line 528 of file LLMManager.cs.
|
inlinestatic |
Sets the LORA download progress.
progress | download progress |
Definition at line 602 of file LLMManager.cs.
|
inlinestatic |
Sets the LLM download progress.
progress | download progress |
Definition at line 593 of file LLMManager.cs.
|
inlinestatic |
Sets the chat template for a model and distributes it to all LLMs using it.
entry | model entry |
chatTemplate | chat template |
Definition at line 221 of file LLMManager.cs.
|
inlinestatic |
Sets the chat template for a model and distributes it to all LLMs using it.
filename | model path |
chatTemplate | chat template |
Definition at line 211 of file LLMManager.cs.
|
inlinestatic |
Setup of the models.
Definition at line 136 of file LLMManager.cs.
|
inlinestatic |
Task performing the setup of the models.
Definition at line 149 of file LLMManager.cs.
|
inlinestatic |
Sets the URL for a model.
entry | model entry |
url | model URL |
Definition at line 516 of file LLMManager.cs.
|
inlinestatic |
Sets the URL for a model.
filename | model filename |
url | model URL |
Definition at line 506 of file LLMManager.cs.
|
inlinestatic |
Removes a LLM from the model manager.
llm | LLM |
Definition at line 312 of file LLMManager.cs.
|
static |
Definition at line 110 of file LLMManager.cs.
|
static |
Definition at line 114 of file LLMManager.cs.
|
static |
Definition at line 115 of file LLMManager.cs.
|
static |
Definition at line 332 of file LLMManager.cs.
|
static |
Definition at line 111 of file LLMManager.cs.
|
static |
Definition at line 331 of file LLMManager.cs.