Reworked the Hugging Face provider (#944)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-08-30 16:45:14 +02:00
1 parent a7228c7782
commit f14c69b938
28 files changed
+1039 -93

No files matched your search

@@ -1,4 +1,5 @@
using AIStudio.Provider;
using AIStudio.Provider.HuggingFace;
namespace AIStudio.Settings;
@@ -53,21 +54,27 @@ public static partial class ProviderExtensions
LLMProviders.DEEP_SEEK => GetModelCapabilitiesDeepSeek(model),
LLMProviders.ALIBABA_CLOUD => GetModelCapabilitiesAlibaba(model),
LLMProviders.PERPLEXITY => GetModelCapabilitiesPerplexity(model),
LLMProviders.OPEN_ROUTER => GetModelCapabilitiesOpenRouter(model),
LLMProviders.OPEN_ROUTER => GetModelCapabilitiesGateway(model),
LLMProviders.HETZNER or LLMProviders.IONOS => GetModelCapabilitiesOpenSource(model),
//
// LiteLLM is a gateway just like OpenRouter, and it names its models the same way:
// "vendor/model", e.g. "anthropic/claude-opus-5" or "azure/gpt-5.6". So we let the
// OpenRouter detection handle it, which resolves the vendor prefix and asks the
// gateway detection handle it, which resolves the vendor prefix and asks the
// provider who really knows the model. Everything it cannot place is treated as
// an open source model, which is the right fallback for a freely named alias:
//
LLMProviders.LITE_LLM => GetModelCapabilitiesOpenRouter(model),
LLMProviders.LITE_LLM => GetModelCapabilitiesGateway(model),
LLMProviders.GROQ => GetModelCapabilitiesOpenSource(model),
LLMProviders.FIREWORKS => GetModelCapabilitiesOpenSource(model),
LLMProviders.HUGGINGFACE => GetModelCapabilitiesOpenSource(model),
LLMProviders.GROQ or LLMProviders.FIREWORKS => GetModelCapabilitiesOpenSource(model),
//
// Hugging Face names its models the way the hub does, "org/model", which is the same
// shape the other gateways use. So we let the gateway detection resolve the organization
// and ask the provider implementation which really knows the model. The routing suffix
// has to go first: it says which inference provider answers, not what the model is.
//
LLMProviders.HUGGINGFACE => GetModelCapabilitiesGateway(model.WithoutRoutingSuffix()),
LLMProviders.HELMHOLTZ => GetModelCapabilitiesOpenSource(model),
LLMProviders.GWDG => GetModelCapabilitiesOpenSource(model),