mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 00:53:48 +00:00
Read model capabilities from the profile everywhere
This commit is contained in:
29 files changed
+163
-108
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using AIStudio.Models;
|
||||
using AIStudio.Provider;
|
||||
|
||||
using Host = AIStudio.Provider.SelfHosted.Host;
|
||||
@@ -39,12 +40,12 @@ public static partial class ProviderExtensions
|
||||
/// </remarks>
|
||||
public static ReasoningIndicatorState GetReasoningIndicatorState(this Provider provider)
|
||||
{
|
||||
var capabilities = provider.GetModelCapabilities();
|
||||
if (capabilities.Contains(Capability.ALWAYS_REASONING))
|
||||
var reasoning = provider.GetModelProfile().Reasoning;
|
||||
if (reasoning is ReasoningSupport.ALWAYS)
|
||||
return ReasoningIndicatorState.ALWAYS_ON;
|
||||
|
||||
|
||||
var reasoningConfigurationState = GetReasoningConfigurationState(provider);
|
||||
if (capabilities.Contains(Capability.REASONING_BY_DEFAULT))
|
||||
if (reasoning is ReasoningSupport.ON_BY_DEFAULT)
|
||||
{
|
||||
return reasoningConfigurationState switch
|
||||
{
|
||||
@@ -54,7 +55,7 @@ public static partial class ProviderExtensions
|
||||
};
|
||||
}
|
||||
|
||||
if (capabilities.Contains(Capability.OPTIONAL_REASONING) &&
|
||||
if (reasoning is ReasoningSupport.OPTIONAL &&
|
||||
reasoningConfigurationState is ReasoningConfigurationState.EXPLICITLY_ENABLED)
|
||||
return ReasoningIndicatorState.CONFIGURED;
|
||||
|
||||
|
||||
@@ -140,11 +140,7 @@ public static partial class ProviderExtensions
|
||||
/// </remarks>
|
||||
/// <param name="provider">The configured provider.</param>
|
||||
/// <returns><c>true</c> when the model accepts image input.</returns>
|
||||
public static bool SupportsImageInput(this Provider provider)
|
||||
{
|
||||
var capabilities = provider.GetModelCapabilities();
|
||||
return capabilities.Contains(Capability.SINGLE_IMAGE_INPUT) || capabilities.Contains(Capability.MULTIPLE_IMAGE_INPUT);
|
||||
}
|
||||
public static bool SupportsImageInput(this Provider provider) => provider.GetModelProfile().HasAny(Capability.SINGLE_IMAGE_INPUT | Capability.MULTIPLE_IMAGE_INPUT);
|
||||
|
||||
/// <summary>
|
||||
/// Get the capabilities of a model for a specific provider.
|
||||
|
||||
Reference in new issue
Block a user