Added the optional HF inference provider setting

This commit is contained in:
Thorsten Sommer 2026-02-05 09:05:23 +01:00
parent 1dea49da7e
commit 7504c99fd7
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 16 additions and 1 deletions

View File

@ -64,6 +64,10 @@ CONFIG["LLM_PROVIDERS"] = {}
-- -- Could be something like ... \"temperature\": 0.5, \"max_tokens\": 1000 ... for multiple parameters. -- -- Could be something like ... \"temperature\": 0.5, \"max_tokens\": 1000 ... for multiple parameters.
-- -- Please do not add the enclosing curly braces {} here. Also, no trailing comma is allowed. -- -- Please do not add the enclosing curly braces {} here. Also, no trailing comma is allowed.
-- ["AdditionalJsonApiParameters"] = "", -- ["AdditionalJsonApiParameters"] = "",
--
-- -- Optional: Hugging Face inference provider. Only relevant for UsedLLMProvider = HUGGINGFACE.
-- -- Allowed values are: CEREBRAS, NEBIUS_AI_STUDIO, SAMBANOVA, NOVITA, HYPERBOLIC, TOGETHER_AI, FIREWORKS, HF_INFERENCE_API
-- -- ["HFInferenceProvider"] = "NOVITA",
-- ["Model"] = { -- ["Model"] = {
-- ["Id"] = "<the model ID>", -- ["Id"] = "<the model ID>",
-- ["DisplayName"] = "<user-friendly name of the model>", -- ["DisplayName"] = "<user-friendly name of the model>",

View File

@ -122,6 +122,16 @@ public sealed record Provider(
return false; return false;
} }
var hfInferenceProvider = HFInferenceProvider.NONE;
if (table.TryGetValue("HFInferenceProvider", out var hfInferenceProviderValue) && hfInferenceProviderValue.TryRead<string>(out var hfInferenceProviderText))
{
if (!Enum.TryParse<HFInferenceProvider>(hfInferenceProviderText, true, out hfInferenceProvider))
{
LOGGER.LogWarning($"The configured provider {idx} does not contain a valid Hugging Face inference provider enum value.");
hfInferenceProvider = HFInferenceProvider.NONE;
}
}
if (!table.TryGetValue("Model", out var modelValue) || !modelValue.TryRead<LuaTable>(out var modelTable)) if (!table.TryGetValue("Model", out var modelValue) || !modelValue.TryRead<LuaTable>(out var modelTable))
{ {
LOGGER.LogWarning($"The configured provider {idx} does not contain a valid model table."); LOGGER.LogWarning($"The configured provider {idx} does not contain a valid model table.");
@ -153,6 +163,7 @@ public sealed record Provider(
EnterpriseConfigurationPluginId = configPluginId, EnterpriseConfigurationPluginId = configPluginId,
Hostname = hostname, Hostname = hostname,
Host = host, Host = host,
HFInferenceProvider = hfInferenceProvider,
AdditionalJsonApiParameters = additionalJsonApiParameters, AdditionalJsonApiParameters = additionalJsonApiParameters,
}; };