2026-09-13 12:17:25 +00:00
|
|
|
using AIStudio.Models;
|
2026-07-04 16:28:52 +00:00
|
|
|
using AIStudio.Provider;
|
2026-09-13 12:17:25 +00:00
|
|
|
using AIStudio.Provider.Reasoning;
|
2026-07-04 16:28:52 +00:00
|
|
|
|
|
|
|
|
namespace AIStudio.Settings;
|
|
|
|
|
|
|
|
|
|
public static partial class ProviderExtensions
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get the effective reasoning indicator state for the configured provider instance.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
2026-09-13 12:17:25 +00:00
|
|
|
/// Two answers meet here, and they answer different questions. What a model is able to do comes
|
|
|
|
|
/// from the rules; what this person asked for comes from the parameters they wrote into their
|
|
|
|
|
/// own provider. A model which thinks unless told otherwise stops showing the indicator when a
|
|
|
|
|
/// parameter turns it off, and a model which can be asked to think shows it only once one does.
|
2026-07-04 16:28:52 +00:00
|
|
|
/// </remarks>
|
2026-09-13 12:17:25 +00:00
|
|
|
/// <param name="provider">The configured provider.</param>
|
|
|
|
|
/// <returns>The effective reasoning indicator state.</returns>
|
2026-07-04 16:28:52 +00:00
|
|
|
public static ReasoningIndicatorState GetReasoningIndicatorState(this Provider provider)
|
|
|
|
|
{
|
2026-09-13 12:17:25 +00:00
|
|
|
var reasoning = provider.GetModelProfile().Reasoning;
|
|
|
|
|
if (reasoning is ReasoningSupport.ALWAYS)
|
2026-07-04 16:28:52 +00:00
|
|
|
return ReasoningIndicatorState.ALWAYS_ON;
|
2026-09-13 12:17:25 +00:00
|
|
|
|
|
|
|
|
var configured = ReasoningDispatcher.WhatTheParametersSay(provider.UsedLLMProvider, provider.Host, provider.AdditionalJsonApiParameters);
|
|
|
|
|
if (reasoning is ReasoningSupport.ON_BY_DEFAULT)
|
2026-07-04 16:28:52 +00:00
|
|
|
{
|
2026-09-13 12:17:25 +00:00
|
|
|
return configured switch
|
2026-07-04 16:28:52 +00:00
|
|
|
{
|
|
|
|
|
ReasoningConfigurationState.EXPLICITLY_DISABLED => ReasoningIndicatorState.NONE,
|
|
|
|
|
ReasoningConfigurationState.EXPLICITLY_ENABLED => ReasoningIndicatorState.CONFIGURED,
|
2026-09-13 12:17:25 +00:00
|
|
|
|
2026-07-04 16:28:52 +00:00
|
|
|
_ => ReasoningIndicatorState.DEFAULT_ON,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-13 12:17:25 +00:00
|
|
|
if (reasoning is ReasoningSupport.OPTIONAL && configured is ReasoningConfigurationState.EXPLICITLY_ENABLED)
|
2026-07-04 16:28:52 +00:00
|
|
|
return ReasoningIndicatorState.CONFIGURED;
|
|
|
|
|
|
|
|
|
|
return ReasoningIndicatorState.NONE;
|
|
|
|
|
}
|
|
|
|
|
}
|