mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 10:39:47 +00:00
Hugging Face works now
This commit is contained in:
parent
15b1a48040
commit
74fa1d14a6
@ -3,14 +3,17 @@
|
|||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EDI/@EntryIndexedValue">EDI</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EDI/@EntryIndexedValue">EDI</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ERI/@EntryIndexedValue">ERI</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ERI/@EntryIndexedValue">ERI</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GWDG/@EntryIndexedValue">GWDG</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GWDG/@EntryIndexedValue">GWDG</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HF/@EntryIndexedValue">HF</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LLM/@EntryIndexedValue">LLM</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LLM/@EntryIndexedValue">LLM</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LM/@EntryIndexedValue">LM</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LM/@EntryIndexedValue">LM</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MSG/@EntryIndexedValue">MSG</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MSG/@EntryIndexedValue">MSG</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RAG/@EntryIndexedValue">RAG</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RAG/@EntryIndexedValue">RAG</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=URL/@EntryIndexedValue">URL</s:String>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=agentic/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=agentic/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=groq/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=groq/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=gwdg/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=gwdg/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=huggingface/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=mwais/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=mwais/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ollama/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=ollama/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=tauri_0027s/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=tauri_0027s/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
@ -65,6 +65,7 @@ public partial class SettingsPanelProviders : SettingsPanelBase
|
|||||||
{ x => x.IsSelfHosted, provider.IsSelfHosted },
|
{ x => x.IsSelfHosted, provider.IsSelfHosted },
|
||||||
{ x => x.IsEditing, true },
|
{ x => x.IsEditing, true },
|
||||||
{ x => x.DataHost, provider.Host },
|
{ x => x.DataHost, provider.Host },
|
||||||
|
{ x => x.HfInstanceProviderId, provider.HFInstanceProvider },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialogReference = await this.DialogService.ShowAsync<ProviderDialog>("Edit LLM Provider", dialogParameters, DialogOptions.FULLSCREEN);
|
var dialogReference = await this.DialogService.ShowAsync<ProviderDialog>("Edit LLM Provider", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
@using AIStudio.Provider
|
@using AIStudio.Provider
|
||||||
|
@using AIStudio.Provider.HuggingFace
|
||||||
@using AIStudio.Provider.SelfHosted
|
@using AIStudio.Provider.SelfHosted
|
||||||
|
|
||||||
<MudDialog>
|
<MudDialog>
|
||||||
@ -49,10 +50,17 @@
|
|||||||
}
|
}
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
|
|
||||||
|
<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)))
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="@instanceProvider">@instanceProvider.ToName()</MudSelectItem>
|
||||||
|
}
|
||||||
|
</MudSelect>
|
||||||
|
|
||||||
<MudStack Row="@true" AlignItems="AlignItems.Center">
|
<MudStack Row="@true" AlignItems="AlignItems.Center">
|
||||||
@if (this.DataLLMProvider.IsLLMModelProvidedManually())
|
@if (this.DataLLMProvider.IsLLMModelProvidedManually())
|
||||||
{
|
{
|
||||||
<MudButton Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.OpenInBrowser" Href="@this.DataLLMProvider.GetModelsOverviewURL()" Target="_blank">Show available models</MudButton>
|
<MudButton Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.OpenInBrowser" Href="@this.DataLLMProvider.GetModelsOverviewURL(this.HfInstanceProviderId)" Target="_blank">Show available models</MudButton>
|
||||||
<MudTextField
|
<MudTextField
|
||||||
T="string"
|
T="string"
|
||||||
@bind-Text="@this.dataManuallyModel"
|
@bind-Text="@this.dataManuallyModel"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using AIStudio.Provider;
|
using AIStudio.Provider;
|
||||||
|
using AIStudio.Provider.HuggingFace;
|
||||||
using AIStudio.Settings;
|
using AIStudio.Settings;
|
||||||
using AIStudio.Tools.Services;
|
using AIStudio.Tools.Services;
|
||||||
using AIStudio.Tools.Validation;
|
using AIStudio.Tools.Validation;
|
||||||
@ -47,6 +48,12 @@ public partial class ProviderDialog : ComponentBase, ISecretId
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public Host DataHost { get; set; } = Host.NONE;
|
public Host DataHost { get; set; } = Host.NONE;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The HFInstanceProvider to use, e.g., CEREBRAS.
|
||||||
|
/// </summary>
|
||||||
|
[Parameter]
|
||||||
|
public HFInstanceProvider HfInstanceProviderId { get; set; } = HFInstanceProvider.NONE;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is this provider self-hosted?
|
/// Is this provider self-hosted?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -131,6 +138,7 @@ public partial class ProviderDialog : ComponentBase, ISecretId
|
|||||||
IsSelfHosted = this.DataLLMProvider is LLMProviders.SELF_HOSTED,
|
IsSelfHosted = this.DataLLMProvider is LLMProviders.SELF_HOSTED,
|
||||||
Hostname = cleanedHostname.EndsWith('/') ? cleanedHostname[..^1] : cleanedHostname,
|
Hostname = cleanedHostname.EndsWith('/') ? cleanedHostname[..^1] : cleanedHostname,
|
||||||
Host = this.DataHost,
|
Host = this.DataHost,
|
||||||
|
HFInstanceProvider = this.HfInstanceProviderId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,8 +159,8 @@ public partial class ProviderDialog : ComponentBase, ISecretId
|
|||||||
{
|
{
|
||||||
this.dataEditingPreviousInstanceName = this.DataInstanceName.ToLowerInvariant();
|
this.dataEditingPreviousInstanceName = this.DataInstanceName.ToLowerInvariant();
|
||||||
|
|
||||||
// When using Fireworks, we must copy the model name:
|
// When using Fireworks or Hugging Face, we must copy the model name:
|
||||||
if (this.DataLLMProvider is LLMProviders.FIREWORKS)
|
if (this.DataLLMProvider is LLMProviders.FIREWORKS or LLMProviders.HUGGINGFACE)
|
||||||
this.dataManuallyModel = this.DataModel.Id;
|
this.dataManuallyModel = this.DataModel.Id;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -235,7 +243,7 @@ public partial class ProviderDialog : ComponentBase, ISecretId
|
|||||||
|
|
||||||
private string? ValidateManuallyModel(string manuallyModel)
|
private string? ValidateManuallyModel(string manuallyModel)
|
||||||
{
|
{
|
||||||
if (this.DataLLMProvider is LLMProviders.FIREWORKS && string.IsNullOrWhiteSpace(manuallyModel))
|
if ((this.DataLLMProvider is LLMProviders.FIREWORKS or LLMProviders.HUGGINGFACE) && string.IsNullOrWhiteSpace(manuallyModel))
|
||||||
return "Please enter a model name.";
|
return "Please enter a model name.";
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -35,10 +35,10 @@ public sealed record Confidence
|
|||||||
""",
|
""",
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly Confidence USA_NOT_TRUSTED = new()
|
public static readonly Confidence USA_HUB = new()
|
||||||
{
|
{
|
||||||
Level = ConfidenceLevel.UNTRUSTED,
|
Level = ConfidenceLevel.UNKNOWN,
|
||||||
Description = "The provider operates its service from the USA and is subject to **U.S. jurisdiction**. In case of suspicion, authorities in the USA can access your data. The provider's terms of service state that **all your data can be used by the provider at will.**",
|
Description = "The provider operates its service from the USA and is subject to **U.S. jurisdiction**. In case of suspicion, authorities in the USA can access your data. Please inform yourself about the use of your data. We do not know if your data is safe.",
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly Confidence UNKNOWN = new()
|
public static readonly Confidence UNKNOWN = new()
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
namespace AIStudio.Provider.HuggingFace;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum for instance providers that Hugging Face supports.
|
||||||
|
/// </summary>
|
||||||
|
public enum HFInstanceProvider
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
|
||||||
|
CEREBRAS,
|
||||||
|
NEBIUS_AI_STUDIO,
|
||||||
|
SAMBANOVA,
|
||||||
|
NOVITA,
|
||||||
|
HYPERBOLIC,
|
||||||
|
TOGETHER_AI,
|
||||||
|
FIREWORKS,
|
||||||
|
HF_INFERENCE_API,
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
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,
|
||||||
|
};
|
||||||
|
}
|
@ -9,8 +9,13 @@ using AIStudio.Settings;
|
|||||||
|
|
||||||
namespace AIStudio.Provider.HuggingFace;
|
namespace AIStudio.Provider.HuggingFace;
|
||||||
|
|
||||||
public sealed class ProviderHuggingFace(ILogger logger) : BaseProvider($"https://router.huggingface.co/nebius/v1/", logger)
|
public sealed class ProviderHuggingFace : BaseProvider
|
||||||
{
|
{
|
||||||
|
public ProviderHuggingFace(ILogger logger, HFInstanceProvider 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)}'.");
|
||||||
|
}
|
||||||
|
|
||||||
#region Implementation of IProvider
|
#region Implementation of IProvider
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -34,7 +34,7 @@ public static class LLMProvidersExtensions
|
|||||||
LLMProviders.GOOGLE => "Google",
|
LLMProviders.GOOGLE => "Google",
|
||||||
LLMProviders.X => "xAI",
|
LLMProviders.X => "xAI",
|
||||||
LLMProviders.DEEP_SEEK => "DeepSeek",
|
LLMProviders.DEEP_SEEK => "DeepSeek",
|
||||||
LLMProviders.ALIBABA_CLOUD => "ALIBABA_CLOUD",
|
LLMProviders.ALIBABA_CLOUD => "Alibaba Cloud",
|
||||||
|
|
||||||
LLMProviders.GROQ => "Groq",
|
LLMProviders.GROQ => "Groq",
|
||||||
LLMProviders.FIREWORKS => "Fireworks.ai",
|
LLMProviders.FIREWORKS => "Fireworks.ai",
|
||||||
@ -58,10 +58,10 @@ public static class LLMProvidersExtensions
|
|||||||
{
|
{
|
||||||
LLMProviders.NONE => Confidence.NONE,
|
LLMProviders.NONE => Confidence.NONE,
|
||||||
|
|
||||||
LLMProviders.FIREWORKS => Confidence.USA_NOT_TRUSTED.WithRegion("America, U.S.").WithSources("https://fireworks.ai/terms-of-service").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
|
LLMProviders.FIREWORKS => Confidence.USA_HUB.WithRegion("America, U.S.").WithSources("https://fireworks.ai/terms-of-service").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
|
||||||
|
|
||||||
// Not trusted, because huggingface only routes you to a third-party-provider and we can't make sure they do not use your data
|
// Not trusted, because huggingface only routes you to a third-party-provider and we can't make sure they do not use your data
|
||||||
LLMProviders.HUGGINGFACE => Confidence.USA_NOT_TRUSTED.WithRegion("America, U.S.").WithSources("https://huggingface.co/terms-of-service").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
|
LLMProviders.HUGGINGFACE => Confidence.USA_HUB.WithRegion("America, U.S.").WithSources("https://huggingface.co/terms-of-service").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
|
||||||
|
|
||||||
LLMProviders.OPEN_AI => Confidence.USA_NO_TRAINING.WithRegion("America, U.S.").WithSources(
|
LLMProviders.OPEN_AI => Confidence.USA_NO_TRAINING.WithRegion("America, U.S.").WithSources(
|
||||||
"https://platform.openai.com/docs/models/default-usage-policies-by-endpoint",
|
"https://platform.openai.com/docs/models/default-usage-policies-by-endpoint",
|
||||||
@ -135,7 +135,7 @@ public static class LLMProvidersExtensions
|
|||||||
/// <returns>The provider instance.</returns>
|
/// <returns>The provider instance.</returns>
|
||||||
public static IProvider CreateProvider(this AIStudio.Settings.Provider providerSettings, ILogger logger)
|
public static IProvider CreateProvider(this AIStudio.Settings.Provider providerSettings, ILogger logger)
|
||||||
{
|
{
|
||||||
return providerSettings.UsedLLMProvider.CreateProvider(providerSettings.InstanceName, providerSettings.Host, providerSettings.Hostname, logger);
|
return providerSettings.UsedLLMProvider.CreateProvider(providerSettings.InstanceName, providerSettings.Host, providerSettings.Hostname, providerSettings.Model, providerSettings.HFInstanceProvider ,logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -146,10 +146,10 @@ public static class LLMProvidersExtensions
|
|||||||
/// <returns>The provider instance.</returns>
|
/// <returns>The provider instance.</returns>
|
||||||
public static IProvider CreateProvider(this EmbeddingProvider embeddingProviderSettings, ILogger logger)
|
public static IProvider CreateProvider(this EmbeddingProvider embeddingProviderSettings, ILogger logger)
|
||||||
{
|
{
|
||||||
return embeddingProviderSettings.UsedLLMProvider.CreateProvider(embeddingProviderSettings.Name, embeddingProviderSettings.Host, embeddingProviderSettings.Hostname, logger);
|
return embeddingProviderSettings.UsedLLMProvider.CreateProvider(embeddingProviderSettings.Name, embeddingProviderSettings.Host, embeddingProviderSettings.Hostname, embeddingProviderSettings.Model, HFInstanceProvider.NONE,logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IProvider CreateProvider(this LLMProviders provider, string instanceName, Host host, string hostname, ILogger logger)
|
private static IProvider CreateProvider(this LLMProviders provider, string instanceName, Host host, string hostname, Model model, HFInstanceProvider instanceProvider , ILogger logger)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -165,7 +165,7 @@ public static class LLMProvidersExtensions
|
|||||||
|
|
||||||
LLMProviders.GROQ => new ProviderGroq(logger) { InstanceName = instanceName },
|
LLMProviders.GROQ => new ProviderGroq(logger) { InstanceName = instanceName },
|
||||||
LLMProviders.FIREWORKS => new ProviderFireworks(logger) { InstanceName = instanceName },
|
LLMProviders.FIREWORKS => new ProviderFireworks(logger) { InstanceName = instanceName },
|
||||||
LLMProviders.HUGGINGFACE => new ProviderHuggingFace(logger) { InstanceName = instanceName },
|
LLMProviders.HUGGINGFACE => new ProviderHuggingFace(logger, instanceProvider, model) { InstanceName = instanceName },
|
||||||
|
|
||||||
LLMProviders.SELF_HOSTED => new ProviderSelfHosted(logger, host, hostname) { InstanceName = instanceName },
|
LLMProviders.SELF_HOSTED => new ProviderSelfHosted(logger, host, hostname) { InstanceName = instanceName },
|
||||||
|
|
||||||
@ -234,10 +234,10 @@ public static class LLMProvidersExtensions
|
|||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static string GetModelsOverviewURL(this LLMProviders provider) => provider switch
|
public static string GetModelsOverviewURL(this LLMProviders provider, HFInstanceProvider instanceProvider) => provider switch
|
||||||
{
|
{
|
||||||
LLMProviders.FIREWORKS => "https://fireworks.ai/models?show=Serverless",
|
LLMProviders.FIREWORKS => "https://fireworks.ai/models?show=Serverless",
|
||||||
LLMProviders.HUGGINGFACE => "https://huggingface.co/models?inference_provider=all",
|
LLMProviders.HUGGINGFACE => $"https://huggingface.co/models?inference_provider={instanceProvider.EndpointsId()}",
|
||||||
_ => string.Empty,
|
_ => string.Empty,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -331,4 +331,10 @@ public static class LLMProvidersExtensions
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsHFInstanceProviderNeeded(this LLMProviders provider) => provider switch
|
||||||
|
{
|
||||||
|
LLMProviders.HUGGINGFACE => true,
|
||||||
|
_ => false,
|
||||||
|
};
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
using AIStudio.Provider;
|
using AIStudio.Provider;
|
||||||
|
using AIStudio.Provider.HuggingFace;
|
||||||
using Host = AIStudio.Provider.SelfHosted.Host;
|
using Host = AIStudio.Provider.SelfHosted.Host;
|
||||||
|
|
||||||
namespace AIStudio.Settings;
|
namespace AIStudio.Settings;
|
||||||
@ -24,7 +24,8 @@ public readonly record struct Provider(
|
|||||||
Model Model,
|
Model Model,
|
||||||
bool IsSelfHosted = false,
|
bool IsSelfHosted = false,
|
||||||
string Hostname = "http://localhost:1234",
|
string Hostname = "http://localhost:1234",
|
||||||
Host Host = Host.NONE) : ISecretId
|
Host Host = Host.NONE,
|
||||||
|
HFInstanceProvider HFInstanceProvider = HFInstanceProvider.NONE) : ISecretId
|
||||||
{
|
{
|
||||||
#region Overrides of ValueType
|
#region Overrides of ValueType
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using AIStudio.Provider;
|
using AIStudio.Provider;
|
||||||
|
using AIStudio.Provider.HuggingFace;
|
||||||
using Host = AIStudio.Provider.SelfHosted.Host;
|
using Host = AIStudio.Provider.SelfHosted.Host;
|
||||||
|
|
||||||
namespace AIStudio.Tools.Validation;
|
namespace AIStudio.Tools.Validation;
|
||||||
@ -93,4 +93,15 @@ public sealed class ProviderValidation
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string? ValidatingHFInstanceProvider(HFInstanceProvider instanceProvider)
|
||||||
|
{
|
||||||
|
if(this.GetProvider() is not LLMProviders.HUGGINGFACE)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (instanceProvider is HFInstanceProvider.NONE)
|
||||||
|
return "Please select an Hugging Face instance provider.";
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user