Making progress

This commit is contained in:
Peer Schütt 2025-08-29 18:43:35 +02:00 committed by Thorsten Sommer
parent e5d46b7481
commit c0ba27d509
2 changed files with 15 additions and 5 deletions

View File

@ -9,6 +9,7 @@ using AIStudio.Provider.Helmholtz;
using AIStudio.Provider.HuggingFace; using AIStudio.Provider.HuggingFace;
using AIStudio.Provider.Mistral; using AIStudio.Provider.Mistral;
using AIStudio.Provider.OpenAI; using AIStudio.Provider.OpenAI;
using AIStudio.Provider.Perplexity;
using AIStudio.Provider.SelfHosted; using AIStudio.Provider.SelfHosted;
using AIStudio.Provider.X; using AIStudio.Provider.X;
using AIStudio.Settings; using AIStudio.Settings;
@ -87,6 +88,8 @@ public static class LLMProvidersExtensions
LLMProviders.DEEP_SEEK => Confidence.CHINA_NO_TRAINING.WithRegion("Asia").WithSources("https://cdn.deepseek.com/policies/en-US/deepseek-open-platform-terms-of-service.html").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)), LLMProviders.DEEP_SEEK => Confidence.CHINA_NO_TRAINING.WithRegion("Asia").WithSources("https://cdn.deepseek.com/policies/en-US/deepseek-open-platform-terms-of-service.html").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
LLMProviders.ALIBABA_CLOUD => Confidence.CHINA_NO_TRAINING.WithRegion("Asia").WithSources("https://www.alibabacloud.com/help/en/model-studio/support/faq-about-alibaba-cloud-model-studio").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)), LLMProviders.ALIBABA_CLOUD => Confidence.CHINA_NO_TRAINING.WithRegion("Asia").WithSources("https://www.alibabacloud.com/help/en/model-studio/support/faq-about-alibaba-cloud-model-studio").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
LLMProviders.PERPLEXITY => Confidence.USA_NO_TRAINING.WithRegion("America, U.S.").WithSources("https://www.perplexity.ai/hub/legal/perplexity-api-terms-of-service").WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
LLMProviders.SELF_HOSTED => Confidence.SELF_HOSTED.WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)), LLMProviders.SELF_HOSTED => Confidence.SELF_HOSTED.WithLevel(settingsManager.GetConfiguredConfidenceLevel(llmProvider)),
@ -122,6 +125,7 @@ public static class LLMProvidersExtensions
LLMProviders.GWDG => false, LLMProviders.GWDG => false,
LLMProviders.DEEP_SEEK => false, LLMProviders.DEEP_SEEK => false,
LLMProviders.HUGGINGFACE => false, LLMProviders.HUGGINGFACE => false,
LLMProviders.PERPLEXITY => false,
// //
// Self-hosted providers are treated as a special case anyway. // Self-hosted providers are treated as a special case anyway.
@ -166,6 +170,7 @@ public static class LLMProvidersExtensions
LLMProviders.X => new ProviderX(logger) { InstanceName = instanceName }, LLMProviders.X => new ProviderX(logger) { InstanceName = instanceName },
LLMProviders.DEEP_SEEK => new ProviderDeepSeek(logger) { InstanceName = instanceName }, LLMProviders.DEEP_SEEK => new ProviderDeepSeek(logger) { InstanceName = instanceName },
LLMProviders.ALIBABA_CLOUD => new ProviderAlibabaCloud(logger) { InstanceName = instanceName }, LLMProviders.ALIBABA_CLOUD => new ProviderAlibabaCloud(logger) { InstanceName = instanceName },
LLMProviders.PERPLEXITY => new ProviderPerplexity(logger) { InstanceName = instanceName },
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 },
@ -195,6 +200,7 @@ public static class LLMProvidersExtensions
LLMProviders.X => "https://accounts.x.ai/sign-up", LLMProviders.X => "https://accounts.x.ai/sign-up",
LLMProviders.DEEP_SEEK => "https://platform.deepseek.com/sign_up", LLMProviders.DEEP_SEEK => "https://platform.deepseek.com/sign_up",
LLMProviders.ALIBABA_CLOUD => "https://account.alibabacloud.com/register/intl_register.htm", LLMProviders.ALIBABA_CLOUD => "https://account.alibabacloud.com/register/intl_register.htm",
LLMProviders.PERPLEXITY => "https://www.perplexity.ai/",
LLMProviders.GROQ => "https://console.groq.com/", LLMProviders.GROQ => "https://console.groq.com/",
LLMProviders.FIREWORKS => "https://fireworks.ai/login", LLMProviders.FIREWORKS => "https://fireworks.ai/login",
@ -217,6 +223,7 @@ public static class LLMProvidersExtensions
LLMProviders.FIREWORKS => "https://fireworks.ai/account/billing", LLMProviders.FIREWORKS => "https://fireworks.ai/account/billing",
LLMProviders.DEEP_SEEK => "https://platform.deepseek.com/usage", LLMProviders.DEEP_SEEK => "https://platform.deepseek.com/usage",
LLMProviders.ALIBABA_CLOUD => "https://usercenter2-intl.aliyun.com/billing", LLMProviders.ALIBABA_CLOUD => "https://usercenter2-intl.aliyun.com/billing",
LLMProviders.PERPLEXITY => "https://www.perplexity.ai/account/api/",
LLMProviders.HUGGINGFACE => "https://huggingface.co/settings/billing", LLMProviders.HUGGINGFACE => "https://huggingface.co/settings/billing",
_ => string.Empty, _ => string.Empty,
@ -233,6 +240,7 @@ public static class LLMProvidersExtensions
LLMProviders.GOOGLE => true, LLMProviders.GOOGLE => true,
LLMProviders.DEEP_SEEK => true, LLMProviders.DEEP_SEEK => true,
LLMProviders.ALIBABA_CLOUD => true, LLMProviders.ALIBABA_CLOUD => true,
LLMProviders.PERPLEXITY => true,
LLMProviders.HUGGINGFACE => true, LLMProviders.HUGGINGFACE => true,
_ => false, _ => false,
@ -279,6 +287,7 @@ public static class LLMProvidersExtensions
LLMProviders.X => true, LLMProviders.X => true,
LLMProviders.DEEP_SEEK => true, LLMProviders.DEEP_SEEK => true,
LLMProviders.ALIBABA_CLOUD => true, LLMProviders.ALIBABA_CLOUD => true,
LLMProviders.PERPLEXITY => true,
LLMProviders.GROQ => true, LLMProviders.GROQ => true,
LLMProviders.FIREWORKS => true, LLMProviders.FIREWORKS => true,
@ -300,6 +309,7 @@ public static class LLMProvidersExtensions
LLMProviders.X => true, LLMProviders.X => true,
LLMProviders.DEEP_SEEK => true, LLMProviders.DEEP_SEEK => true,
LLMProviders.ALIBABA_CLOUD => true, LLMProviders.ALIBABA_CLOUD => true,
LLMProviders.PERPLEXITY => true,
LLMProviders.GROQ => true, LLMProviders.GROQ => true,
LLMProviders.FIREWORKS => true, LLMProviders.FIREWORKS => true,

View File

@ -17,7 +17,7 @@ public sealed class ProviderPerplexity(ILogger logger) : BaseProvider("https://a
public override string Id => LLMProviders.PERPLEXITY.ToName(); public override string Id => LLMProviders.PERPLEXITY.ToName();
/// <inheritdoc /> /// <inheritdoc />
public override string InstanceName { get; set; } = "DeepSeek"; public override string InstanceName { get; set; } = "Perplexity";
/// <inheritdoc /> /// <inheritdoc />
public override async IAsyncEnumerable<string> StreamChatCompletion(Model chatModel, ChatThread chatThread, SettingsManager settingsManager, [EnumeratorCancellation] CancellationToken token = default) public override async IAsyncEnumerable<string> StreamChatCompletion(Model chatModel, ChatThread chatThread, SettingsManager settingsManager, [EnumeratorCancellation] CancellationToken token = default)
@ -34,8 +34,8 @@ public sealed class ProviderPerplexity(ILogger logger) : BaseProvider("https://a
Content = chatThread.PrepareSystemPrompt(settingsManager, chatThread, this.logger), Content = chatThread.PrepareSystemPrompt(settingsManager, chatThread, this.logger),
}; };
// Prepare the DeepSeek HTTP chat request: // Prepare the Perplexity HTTP chat request:
var deepSeekChatRequest = JsonSerializer.Serialize(new ChatRequest var perplexityChatRequest = JsonSerializer.Serialize(new ChatRequest
{ {
Model = chatModel.Id, Model = chatModel.Id,
@ -72,11 +72,11 @@ public sealed class ProviderPerplexity(ILogger logger) : BaseProvider("https://a
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", await requestedSecret.Secret.Decrypt(ENCRYPTION)); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", await requestedSecret.Secret.Decrypt(ENCRYPTION));
// Set the content: // Set the content:
request.Content = new StringContent(deepSeekChatRequest, Encoding.UTF8, "application/json"); request.Content = new StringContent(perplexityChatRequest, Encoding.UTF8, "application/json");
return request; return request;
} }
await foreach (var content in this.StreamChatCompletionInternal<ResponseStreamLine>("DeepSeek", RequestBuilder, token)) await foreach (var content in this.StreamChatCompletionInternal<ResponseStreamLine>("Perplexity", RequestBuilder, token))
yield return content; yield return content;
} }