mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 15:53:48 +00:00
added functionality to add tokenizer to LLM and embedding models
This commit is contained in:
1 parent
0854debc00
commit
e07ca378d4
15 files changed
+201
-43
No files matched your search
@@ -19,7 +19,8 @@ public sealed record EmbeddingProvider(
|
||||
bool IsEnterpriseConfiguration = false,
|
||||
Guid EnterpriseConfigurationPluginId = default,
|
||||
string Hostname = "http://localhost:1234",
|
||||
Host Host = Host.NONE) : ConfigurationBaseObject, ISecretId
|
||||
Host Host = Host.NONE,
|
||||
string TokenizerPath = "") : ConfigurationBaseObject, ISecretId
|
||||
{
|
||||
private static readonly ILogger<EmbeddingProvider> LOGGER = Program.LOGGER_FACTORY.CreateLogger<EmbeddingProvider>();
|
||||
|
||||
@@ -96,6 +97,13 @@ public sealed record EmbeddingProvider(
|
||||
return false;
|
||||
}
|
||||
|
||||
var tokenizerPath = string.Empty;
|
||||
if (table.TryGetValue("TokenizerPath", out var tokenizerPathValue) && !tokenizerPathValue.TryRead<string>(out tokenizerPath))
|
||||
{
|
||||
LOGGER.LogWarning($"The configured embedding provider {idx} does not contain a valid tokenizer path. (Plugin ID: {configPluginId})");
|
||||
tokenizerPath = string.Empty;
|
||||
}
|
||||
|
||||
provider = new EmbeddingProvider
|
||||
{
|
||||
Num = 0, // will be set later by the PluginConfigurationObject
|
||||
@@ -108,6 +116,7 @@ public sealed record EmbeddingProvider(
|
||||
EnterpriseConfigurationPluginId = configPluginId,
|
||||
Hostname = hostname,
|
||||
Host = host,
|
||||
TokenizerPath = tokenizerPath,
|
||||
};
|
||||
|
||||
// Handle encrypted API key if present:
|
||||
|
||||
@@ -32,7 +32,8 @@ public sealed record Provider(
|
||||
string Hostname = "http://localhost:1234",
|
||||
Host Host = Host.NONE,
|
||||
HFInferenceProvider HFInferenceProvider = HFInferenceProvider.NONE,
|
||||
string AdditionalJsonApiParameters = "") : ConfigurationBaseObject, ISecretId
|
||||
string AdditionalJsonApiParameters = "",
|
||||
string TokenizerPath = "") : ConfigurationBaseObject, ISecretId
|
||||
{
|
||||
private static readonly ILogger<Provider> LOGGER = Program.LOGGER_FACTORY.CreateLogger<Provider>();
|
||||
|
||||
@@ -151,6 +152,13 @@ public sealed record Provider(
|
||||
additionalJsonApiParameters = string.Empty;
|
||||
}
|
||||
|
||||
var tokenizerPath = string.Empty;
|
||||
if (table.TryGetValue("TokenizerPath", out var tokenizerPathValue) && !tokenizerPathValue.TryRead<string>(out tokenizerPath))
|
||||
{
|
||||
LOGGER.LogWarning($"The configured provider {idx} does not contain a valid tokenizer path. (Plugin ID: {configPluginId})");
|
||||
tokenizerPath = string.Empty;
|
||||
}
|
||||
|
||||
provider = new Provider
|
||||
{
|
||||
Num = 0, // will be set later by the PluginConfigurationObject
|
||||
@@ -165,6 +173,7 @@ public sealed record Provider(
|
||||
Host = host,
|
||||
HFInferenceProvider = hfInferenceProvider,
|
||||
AdditionalJsonApiParameters = additionalJsonApiParameters,
|
||||
TokenizerPath = tokenizerPath,
|
||||
};
|
||||
|
||||
// Handle encrypted API key if present:
|
||||
|
||||
Reference in new issue
Block a user