Updated documentation (#409)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2025-04-20 15:24:43 +02:00
1 parent c10c084da4
commit 2144cfe059
15 files changed
+104 -77

No files matched your search

@@ -65,7 +65,7 @@ public partial class SettingsPanelProviders : SettingsPanelBase
{ x => x.IsSelfHosted, provider.IsSelfHosted },
{ x => x.IsEditing, true },
{ x => x.DataHost, provider.Host },
{ x => x.HfInstanceProviderId, provider.HFInstanceProvider },
{ x => x.HFInferenceProviderId, provider.HFInferenceProvider },
};
var dialogReference = await this.DialogService.ShowAsync<ProviderDialog>("Edit LLM Provider", dialogParameters, DialogOptions.FULLSCREEN);
@@ -61,20 +61,22 @@
@if (this.DataLLMProvider.IsHFInstanceProviderNeeded())
{
<MudSelect Disabled="@(!this.DataLLMProvider.IsHFInstanceProviderNeeded())" @bind-Value="@this.HfInstanceProviderId" Label="HF Instance Provider" Class="mb-3" OpenIcon="@Icons.Material.Filled.Dns" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingHFInstanceProvider">
@foreach (HFInstanceProvider instanceProvider in Enum.GetValues(typeof(HFInstanceProvider)))
<MudSelect Disabled="@(!this.DataLLMProvider.IsHFInstanceProviderNeeded())" @bind-Value="@this.HFInferenceProviderId" Label="HF Inference Provider" Class="mb-3" OpenIcon="@Icons.Material.Filled.Dns" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingHFInstanceProvider">
@foreach (HFInferenceProvider inferenceProvider in Enum.GetValues(typeof(HFInferenceProvider)))
{
<MudSelectItem Value="@instanceProvider">@instanceProvider.ToName()</MudSelectItem>
<MudSelectItem Value="@inferenceProvider">
@inferenceProvider.ToName()
</MudSelectItem>
}
</MudSelect>
<MudJustifiedText Class="mb-3"> Please double-check if your model name matches the curl specifications provided by the instance provider. If it doesn't, you might get a <b>Not Found</b> error when trying to use the model. Here's a <MudLink Href="https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct?inference_api=true&inference_provider=novita&language=sh" Target="_blank">curl example</MudLink>.</MudJustifiedText>
<MudJustifiedText Class="mb-3"> Please double-check if your model name matches the curl specifications provided by the inference provider. If it doesn't, you might get a <b>Not Found</b> error when trying to use the model. Here's a <MudLink Href="https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct?inference_api=true&inference_provider=novita&language=sh" Target="_blank">curl example</MudLink>.</MudJustifiedText>
}
<MudStack Row="@true" AlignItems="AlignItems.Center">
@if (this.DataLLMProvider.IsLLMModelProvidedManually())
{
<MudButton Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.OpenInBrowser" Href="@this.DataLLMProvider.GetModelsOverviewURL(this.HfInstanceProviderId)" Target="_blank">Show available models</MudButton>
<MudButton Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.OpenInBrowser" Href="@this.DataLLMProvider.GetModelsOverviewURL(this.HFInferenceProviderId)" Target="_blank">Show available models</MudButton>
<MudTextField
T="string"
@bind-Text="@this.dataManuallyModel"
@@ -52,7 +52,7 @@ public partial class ProviderDialog : ComponentBase, ISecretId
/// The HFInstanceProvider to use, e.g., CEREBRAS.
/// </summary>
[Parameter]
public HFInstanceProvider HfInstanceProviderId { get; set; } = HFInstanceProvider.NONE;
public HFInferenceProvider HFInferenceProviderId { get; set; } = HFInferenceProvider.NONE;
/// <summary>
/// Is this provider self-hosted?
@@ -138,7 +138,7 @@ public partial class ProviderDialog : ComponentBase, ISecretId
IsSelfHosted = this.DataLLMProvider is LLMProviders.SELF_HOSTED,
Hostname = cleanedHostname.EndsWith('/') ? cleanedHostname[..^1] : cleanedHostname,
Host = this.DataHost,
HFInstanceProvider = this.HfInstanceProviderId,
HFInferenceProvider = this.HFInferenceProviderId,
};
}
+1 -1
View File
@@ -39,7 +39,7 @@ public partial class Home : MSGComponentBase
private static readonly TextItem[] ITEMS_ADVANTAGES =
[
new("Free of charge", "The app is free to use, both for personal and commercial purposes."),
new("Independence", "You are not tied to any single provider. Instead, you might choose the provider that best suits your needs. Right now, we support OpenAI (GPT4o, o1, etc.), Mistral, Anthropic (Claude), Google Gemini, xAI (Grok), DeepSeek, and self-hosted models using llama.cpp, ollama, LM Studio, Groq, or Fireworks. For scientists and employees of research institutions, we also support Helmholtz and GWDG AI services. These are available through federated logins like eduGAIN to all 18 Helmholtz Centers, the Max Planck Society, most German, and many international universities."),
new("Independence", "You are not tied to any single provider. Instead, you might choose the provider that best suits your needs. Right now, we support OpenAI (GPT4o, o1, etc.), Mistral, Anthropic (Claude), Google Gemini, xAI (Grok), DeepSeek, Alibaba Cloud (Qwen), Hugging Face, and self-hosted models using llama.cpp, ollama, LM Studio, Groq, or Fireworks. For scientists and employees of research institutions, we also support Helmholtz and GWDG AI services. These are available through federated logins like eduGAIN to all 18 Helmholtz Centers, the Max Planck Society, most German, and many international universities."),
new("Assistants", "You just want to quickly translate a text? AI Studio has so-called assistants for such and other tasks. No prompting is necessary when working with these assistants."),
new("Unrestricted usage", "Unlike services like ChatGPT, which impose limits after intensive use, MindWork AI Studio offers unlimited usage through the providers API."),
new("Cost-effective", "You only pay for what you use, which can be cheaper than monthly subscription services like ChatGPT Plus, especially if used infrequently. But beware, here be dragons: For extremely intensive usage, the API costs can be significantly higher. Unfortunately, providers currently do not offer a way to display current costs in the app. Therefore, check your account with the respective provider to see how your costs are developing. When available, use prepaid and set a cost limit."),
@@ -1,9 +1,9 @@
namespace AIStudio.Provider.HuggingFace;
/// <summary>
/// Enum for instance providers that Hugging Face supports.
/// Enum for inference providers that Hugging Face supports.
/// </summary>
public enum HFInstanceProvider
public enum HFInferenceProvider
{
NONE,
@@ -0,0 +1,43 @@
namespace AIStudio.Provider.HuggingFace;
public static class HFInferenceProviderExtensions
{
public static string Endpoints(this HFInferenceProvider provider, Model model) => provider switch
{
HFInferenceProvider.CEREBRAS => "cerebras/v1/",
HFInferenceProvider.NEBIUS_AI_STUDIO => "nebius/v1/",
HFInferenceProvider.SAMBANOVA => "sambanova/v1/",
HFInferenceProvider.NOVITA => "novita/v3/openai/",
HFInferenceProvider.HYPERBOLIC => "hyperbolic/v1/",
HFInferenceProvider.TOGETHER_AI => "together/v1/",
HFInferenceProvider.FIREWORKS => "fireworks-ai/inference/v1/",
HFInferenceProvider.HF_INFERENCE_API => $"hf-inference/models/{model.ToString()}/v1/",
_ => string.Empty,
};
public static string EndpointsId(this HFInferenceProvider provider) => provider switch
{
HFInferenceProvider.CEREBRAS => "cerebras",
HFInferenceProvider.NEBIUS_AI_STUDIO => "nebius",
HFInferenceProvider.SAMBANOVA => "sambanova",
HFInferenceProvider.NOVITA => "novita",
HFInferenceProvider.HYPERBOLIC => "hyperbolic",
HFInferenceProvider.TOGETHER_AI => "together",
HFInferenceProvider.FIREWORKS => "fireworks",
HFInferenceProvider.HF_INFERENCE_API => "hf-inference",
_ => string.Empty,
};
public static string ToName(this HFInferenceProvider provider) => provider switch
{
HFInferenceProvider.CEREBRAS => "Cerebras",
HFInferenceProvider.NEBIUS_AI_STUDIO => "Nebius AI Studio",
HFInferenceProvider.SAMBANOVA => "Sambanova",
HFInferenceProvider.NOVITA => "Novita",
HFInferenceProvider.HYPERBOLIC => "Hyperbolic",
HFInferenceProvider.TOGETHER_AI => "Together AI",
HFInferenceProvider.FIREWORKS => "Fireworks AI",
HFInferenceProvider.HF_INFERENCE_API => "Hugging Face Inference API",
_ => string.Empty,
};
}
@@ -1,43 +0,0 @@
namespace AIStudio.Provider.HuggingFace;
public static class HFInstanceProviderExtensions
{
public static string Endpoints(this HFInstanceProvider provider, Model model) => provider switch
{
HFInstanceProvider.CEREBRAS => "cerebras/v1/",
HFInstanceProvider.NEBIUS_AI_STUDIO => "nebius/v1/",
HFInstanceProvider.SAMBANOVA => "sambanova/v1/",
HFInstanceProvider.NOVITA => "novita/v3/openai/",
HFInstanceProvider.HYPERBOLIC => "hyperbolic/v1/",
HFInstanceProvider.TOGETHER_AI => "together/v1/",
HFInstanceProvider.FIREWORKS => "fireworks-ai/inference/v1/",
HFInstanceProvider.HF_INFERENCE_API => $"hf-inference/models/{model.ToString()}/v1/",
_ => string.Empty,
};
public static string EndpointsId(this HFInstanceProvider provider) => provider switch
{
HFInstanceProvider.CEREBRAS => "cerebras",
HFInstanceProvider.NEBIUS_AI_STUDIO => "nebius",
HFInstanceProvider.SAMBANOVA => "sambanova",
HFInstanceProvider.NOVITA => "novita",
HFInstanceProvider.HYPERBOLIC => "hyperbolic",
HFInstanceProvider.TOGETHER_AI => "together",
HFInstanceProvider.FIREWORKS => "fireworks",
HFInstanceProvider.HF_INFERENCE_API => "hf-inference",
_ => string.Empty,
};
public static string ToName(this HFInstanceProvider provider) => provider switch
{
HFInstanceProvider.CEREBRAS => "Cerebras",
HFInstanceProvider.NEBIUS_AI_STUDIO => "Nebius AI Studio",
HFInstanceProvider.SAMBANOVA => "Sambanova",
HFInstanceProvider.NOVITA => "Novita",
HFInstanceProvider.HYPERBOLIC => "Hyperbolic",
HFInstanceProvider.TOGETHER_AI => "Together AI",
HFInstanceProvider.FIREWORKS => "Fireworks AI",
HFInstanceProvider.HF_INFERENCE_API => "Hugging Face Inference API",
_ => string.Empty,
};
}
@@ -11,9 +11,9 @@ namespace AIStudio.Provider.HuggingFace;
public sealed class ProviderHuggingFace : BaseProvider
{
public ProviderHuggingFace(ILogger logger, HFInstanceProvider hfProvider, Model model) : base($"https://router.huggingface.co/{hfProvider.Endpoints(model)}", logger)
public ProviderHuggingFace(ILogger logger, HFInferenceProvider hfProvider, Model model) : base($"https://router.huggingface.co/{hfProvider.Endpoints(model)}", logger)
{
logger.LogInformation($"We use the instance provider '{hfProvider}'. Thus we use the base URL 'https://router.huggingface.co/{hfProvider.Endpoints(model)}'.");
logger.LogInformation($"We use the inferende provider '{hfProvider}'. Thus we use the base URL 'https://router.huggingface.co/{hfProvider.Endpoints(model)}'.");
}
#region Implementation of IProvider
@@ -135,7 +135,7 @@ public static class LLMProvidersExtensions
/// <returns>The provider instance.</returns>
public static IProvider CreateProvider(this AIStudio.Settings.Provider providerSettings, ILogger logger)
{
return providerSettings.UsedLLMProvider.CreateProvider(providerSettings.InstanceName, providerSettings.Host, providerSettings.Hostname, providerSettings.Model, providerSettings.HFInstanceProvider ,logger);
return providerSettings.UsedLLMProvider.CreateProvider(providerSettings.InstanceName, providerSettings.Host, providerSettings.Hostname, providerSettings.Model, providerSettings.HFInferenceProvider ,logger);
}
/// <summary>
@@ -146,10 +146,10 @@ public static class LLMProvidersExtensions
/// <returns>The provider instance.</returns>
public static IProvider CreateProvider(this EmbeddingProvider embeddingProviderSettings, ILogger logger)
{
return embeddingProviderSettings.UsedLLMProvider.CreateProvider(embeddingProviderSettings.Name, embeddingProviderSettings.Host, embeddingProviderSettings.Hostname, embeddingProviderSettings.Model, HFInstanceProvider.NONE,logger);
return embeddingProviderSettings.UsedLLMProvider.CreateProvider(embeddingProviderSettings.Name, embeddingProviderSettings.Host, embeddingProviderSettings.Hostname, embeddingProviderSettings.Model, HFInferenceProvider.NONE,logger);
}
private static IProvider CreateProvider(this LLMProviders provider, string instanceName, Host host, string hostname, Model model, HFInstanceProvider instanceProvider , ILogger logger)
private static IProvider CreateProvider(this LLMProviders provider, string instanceName, Host host, string hostname, Model model, HFInferenceProvider inferenceProvider , ILogger logger)
{
try
{
@@ -165,7 +165,7 @@ public static class LLMProvidersExtensions
LLMProviders.GROQ => new ProviderGroq(logger) { InstanceName = instanceName },
LLMProviders.FIREWORKS => new ProviderFireworks(logger) { InstanceName = instanceName },
LLMProviders.HUGGINGFACE => new ProviderHuggingFace(logger, instanceProvider, model) { InstanceName = instanceName },
LLMProviders.HUGGINGFACE => new ProviderHuggingFace(logger, inferenceProvider, model) { InstanceName = instanceName },
LLMProviders.SELF_HOSTED => new ProviderSelfHosted(logger, host, hostname) { InstanceName = instanceName },
@@ -234,10 +234,10 @@ public static class LLMProvidersExtensions
_ => false,
};
public static string GetModelsOverviewURL(this LLMProviders provider, HFInstanceProvider instanceProvider) => provider switch
public static string GetModelsOverviewURL(this LLMProviders provider, HFInferenceProvider inferenceProvider) => provider switch
{
LLMProviders.FIREWORKS => "https://fireworks.ai/models?show=Serverless",
LLMProviders.HUGGINGFACE => $"https://huggingface.co/models?inference_provider={instanceProvider.EndpointsId()}",
LLMProviders.HUGGINGFACE => $"https://huggingface.co/models?inference_provider={inferenceProvider.EndpointsId()}",
_ => string.Empty,
};
+1 -1
View File
@@ -25,7 +25,7 @@ public readonly record struct Provider(
bool IsSelfHosted = false,
string Hostname = "http://localhost:1234",
Host Host = Host.NONE,
HFInstanceProvider HFInstanceProvider = HFInstanceProvider.NONE) : ISecretId
HFInferenceProvider HFInferenceProvider = HFInferenceProvider.NONE) : ISecretId
{
#region Overrides of ValueType
@@ -94,13 +94,13 @@ public sealed class ProviderValidation
return null;
}
public string? ValidatingHFInstanceProvider(HFInstanceProvider instanceProvider)
public string? ValidatingHFInstanceProvider(HFInferenceProvider inferenceProvider)
{
if(this.GetProvider() is not LLMProviders.HUGGINGFACE)
return null;
if (instanceProvider is HFInstanceProvider.NONE)
return "Please select an Hugging Face instance provider.";
if (inferenceProvider is HFInferenceProvider.NONE)
return "Please select an Hugging Face inference provider.";
return null;
}
@@ -2,6 +2,7 @@
- Added support for the announced OpenAI `o4` models.
- Added Alibaba Cloud as a new provider. Thanks Peer `peerschuett` for the contribution.
- Added the Hugging Face inference provider as an LLM provider to AI Studio. Thanks Peer `peerschuett` for the contribution.
- Added the current CPU architecture to the about page. This information helps us identify issues.
- Improved the LLM & embedding provider dialogs by hiding not relevant options.
- Improved the provider selection by showing the name of the provider in the provider selection instead of its identifier.
- Improved the developer experience by adding a tolerant enum converter for better configuration handling.