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

@@ -126,9 +126,57 @@ public sealed class ProviderValidation
if(this.GetProvider() is not LLMProviders.HUGGINGFACE)
return null;
if (inferenceProvider is HFInferenceProvider.NONE)
if (!inferenceProvider.SupportsChat())
return TB("Please select an Hugging Face inference provider.");
return null;
}
/// <summary>
/// Validates the Hugging Face inference provider chosen for embeddings.
/// </summary>
/// <remarks>
/// Far fewer providers create embeddings for us than serve chat models, so a selection which is
/// fine for chatting may not be for embeddings. A provider configured before the choice narrowed
/// is no longer among the options, which would leave the user with an empty field and no reason
/// given.
/// </remarks>
/// <param name="inferenceProvider">The inference provider to validate.</param>
/// <returns>The message to show, or null when the selection is fine.</returns>
public string? ValidatingHFInstanceProviderForEmbeddings(HFInferenceProvider inferenceProvider)
{
if(this.GetProvider() is not LLMProviders.HUGGINGFACE)
return null;
if (inferenceProvider is HFInferenceProvider.NONE)
return TB("Please select an Hugging Face inference provider.");
if (!inferenceProvider.SupportsEmbeddings())
return TB("This Hugging Face inference provider does not create embeddings. Please select another one.");
return null;
}
/// <summary>
/// Validates the Hugging Face inference provider chosen for transcription.
/// </summary>
/// <remarks>
/// As with embeddings, only some of the inference providers transcribe audio for us, so the
/// choice is narrower than it is for chatting.
/// </remarks>
/// <param name="inferenceProvider">The inference provider to validate.</param>
/// <returns>The message to show, or null when the selection is fine.</returns>
public string? ValidatingHFInstanceProviderForTranscription(HFInferenceProvider inferenceProvider)
{
if(this.GetProvider() is not LLMProviders.HUGGINGFACE)
return null;
if (inferenceProvider is HFInferenceProvider.NONE)
return TB("Please select an Hugging Face inference provider.");
if (!inferenceProvider.SupportsTranscription())
return TB("This Hugging Face inference provider does not transcribe audio. Please select another one.");
return null;
}
}