Turned getter-like extension methods into extension properties (#1157)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-04 13:00:56 +01:00
1 parent 0375318b1b
commit f649febf88
286 files changed
+1379 -1109

No files matched your search

@@ -40,8 +40,8 @@ public static class LLMProvidersExtensions
/// This value is UI text and may be localized. Do not use it for persisted IDs, secret namespaces,
/// or other stable identifiers.
/// </remarks>
/// <returns>The human-readable name of the provider.</returns>
public string ToName() => provider.ToName(translate: true);
/// <value>The human-readable name of the provider.</value>
public string Name => provider.ToName(translate: true);
/// <summary>
/// Returns the human-readable name of the provider.
@@ -85,8 +85,8 @@ public static class LLMProvidersExtensions
/// These values are used for OS keyring namespaces. They must never be localized or changed without
/// an explicit migration for existing API keys.
/// </remarks>
/// <returns>The stable secret namespace for the provider.</returns>
public string ToSecretId() => provider switch
/// <value>The stable secret namespace for the provider.</value>
public string SecretId => provider switch
{
LLMProviders.NONE => "No provider selected",
@@ -195,8 +195,8 @@ public static class LLMProvidersExtensions
/// <summary>
/// Determines if the specified provider supports embeddings.
/// </summary>
/// <returns>True if the provider supports embeddings; otherwise, false.</returns>
public bool ProvideEmbeddingAPI() => provider switch
/// <value>True if the provider supports embeddings; otherwise, false.</value>
public bool ProvideEmbeddingAPI => provider switch
{
//
// Providers that support embeddings:
@@ -239,7 +239,7 @@ public static class LLMProvidersExtensions
_ => false,
};
public bool ProvideTranscriptionAPI() => provider switch
public bool ProvideTranscriptionAPI => provider switch
{
//
// Providers that support transcription:
@@ -294,8 +294,8 @@ public static class LLMProvidersExtensions
/// larger images through another provider. What we actually send is asked through
/// IImageSourceExtensions.MaxImageSizeBytesFor, which also applies our own limit.
/// </remarks>
/// <returns>The size limit of one image file, or null when the provider states none we know of.</returns>
public long? GetMaxImageSizeBytes() => provider switch
/// <value>The size limit of one image file, or null when the provider states none we know of.</value>
public long? MaxImageSizeBytes => provider switch
{
//
// Anthropic accepts at most 5 MiB (5,242,880 bytes) of base64 per image. Base64 needs four
@@ -360,7 +360,7 @@ public static class LLMProvidersExtensions
}
}
public string GetCreationURL() => provider switch
public string CreationURL => provider switch
{
LLMProviders.OPEN_AI => "https://platform.openai.com/signup",
LLMProviders.MISTRAL => "https://console.mistral.ai/",
@@ -385,7 +385,7 @@ public static class LLMProvidersExtensions
_ => string.Empty,
};
public string GetDashboardURL() => provider switch
public string DashboardURL => provider switch
{
LLMProviders.OPEN_AI => "https://platform.openai.com/usage",
LLMProviders.MISTRAL => "https://console.mistral.ai/usage/",
@@ -408,7 +408,7 @@ public static class LLMProvidersExtensions
_ => string.Empty,
};
public bool HasDashboard() => provider switch
public bool HasDashboard => provider switch
{
LLMProviders.OPEN_AI => true,
LLMProviders.MISTRAL => true,
@@ -434,11 +434,11 @@ public static class LLMProvidersExtensions
public string GetModelsOverviewURL(HFInferenceProvider inferenceProvider) => provider switch
{
LLMProviders.FIREWORKS => "https://fireworks.ai/models?show=Serverless",
LLMProviders.HUGGINGFACE => $"https://huggingface.co/models?inference_provider={inferenceProvider.CatalogFilter()}",
LLMProviders.HUGGINGFACE => $"https://huggingface.co/models?inference_provider={inferenceProvider.CatalogFilter}",
_ => string.Empty,
};
public bool IsLLMModelProvidedManually() => provider switch
public bool IsLLMModelProvidedManually => provider switch
{
LLMProviders.FIREWORKS => true,
_ => false,
@@ -467,13 +467,13 @@ public static class LLMProvidersExtensions
_ => false,
};
public bool IsHostNeeded() => provider switch
public bool IsHostNeeded => provider switch
{
LLMProviders.SELF_HOSTED => true,
_ => false,
};
public bool IsHostnameNeeded() => provider switch
public bool IsHostnameNeeded => provider switch
{
LLMProviders.SELF_HOSTED => true,
LLMProviders.LITE_LLM => true,
@@ -490,8 +490,8 @@ public static class LLMProvidersExtensions
/// today: whether a dialog asks for a hostname is a question of the user interface, and it must
/// never silently decide what a server learns about the user.
/// </remarks>
/// <returns>True when the provider runs on a self-hosted server; otherwise, false.</returns>
public bool RunsOnSelfHostedServer() => provider switch
/// <value>True when the provider runs on a self-hosted server; otherwise, false.</value>
public bool RunsOnSelfHostedServer => provider switch
{
LLMProviders.SELF_HOSTED => true,
LLMProviders.LITE_LLM => true,
@@ -529,7 +529,7 @@ public static class LLMProvidersExtensions
_ => false,
};
public bool ShowRegisterButton() => provider switch
public bool ShowRegisterButton => provider switch
{
LLMProviders.OPEN_AI => true,
LLMProviders.MISTRAL => true,
@@ -556,7 +556,7 @@ public static class LLMProvidersExtensions
public bool CanLoadModels(Host host, string? apiKey)
{
if (provider is LLMProviders.SELF_HOSTED)
return host.IsModelListSupported();
return host.IsModelListSupported;
if(provider is LLMProviders.NONE)
return false;
@@ -567,7 +567,7 @@ public static class LLMProvidersExtensions
return true;
}
public bool IsHFInstanceProviderNeeded() => provider switch
public bool IsHFInstanceProviderNeeded => provider switch
{
LLMProviders.HUGGINGFACE => true,
_ => false,