mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 05:21:36 +00:00
Added the optional HF inference provider setting
This commit is contained in:
parent
1dea49da7e
commit
7504c99fd7
@ -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>",
|
||||||
|
|||||||
@ -121,6 +121,16 @@ public sealed record Provider(
|
|||||||
LOGGER.LogWarning($"The configured provider {idx} does not contain a valid hostname.");
|
LOGGER.LogWarning($"The configured provider {idx} does not contain a valid hostname.");
|
||||||
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))
|
||||||
{
|
{
|
||||||
@ -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,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -177,4 +188,4 @@ public sealed record Provider(
|
|||||||
model = new(id, displayName);
|
model = new(id, displayName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user