Improved the start of configuration plugins with tokenizers (#1039)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-10-10 12:51:20 +02:00
1 parent 5c319c45a0
commit 3d847555d7
8 files changed
+714 -28

No files matched your search

@@ -0,0 +1,36 @@
using AIStudio.Tools.Rust;
namespace AIStudio.Tools.Services;
/// <summary>
/// Checks, stores, and deletes the tokenizers the app keeps below its data directory.
/// </summary>
/// <remarks>
/// The runtime does the work, and RustService passes the calls on. Code which decides when a
/// tokenizer has to be checked or stored takes this interface instead of the service, so tests can
/// examine these decisions without a running runtime.
/// </remarks>
internal interface ITokenizerStorage
{
/// <summary>
/// Checks whether a file is a tokenizer the runtime can load.
/// </summary>
/// <param name="filePath">The tokenizer file to check.</param>
/// <returns>Whether the file is a usable tokenizer, and if not, why.</returns>
public Task<TokenizerResponse> ValidateTokenizer(string filePath);
/// <summary>
/// Copies a tokenizer below the data directory, replacing what was stored for the model before.
/// </summary>
/// <param name="modelId">The model the tokenizer belongs to, as TokenizerModelId builds it.</param>
/// <param name="filePath">The tokenizer file to copy.</param>
/// <returns>Whether storing succeeded, along with the path of the stored copy.</returns>
public Task<TokenizerResponse> StoreTokenizer(string modelId, string filePath);
/// <summary>
/// Deletes what is stored for the model. Nothing stored counts as success.
/// </summary>
/// <param name="modelId">The model the tokenizer belongs to, as TokenizerModelId builds it.</param>
/// <returns>Whether deleting succeeded.</returns>
public Task<TokenizerResponse> DeleteTokenizer(string modelId);
}