mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 02:39:00 +00:00
Rebuilt how AI Studio knows what a model can do (#960)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
This commit is contained in:
1 parent
d21e09dd1e
commit
d85b4e71b6
287 files changed
+18341
-3677
No files matched your search
@@ -0,0 +1,60 @@
|
||||
using AIStudio.Models;
|
||||
using AIStudio.Models.Registry;
|
||||
using AIStudio.Provider;
|
||||
|
||||
namespace AIStudio.Tests.Models.Corpus;
|
||||
|
||||
/// <summary>
|
||||
/// Asks the rebuilt rules about a corpus entry, in the words the old ones answered in.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The two systems say the same things in different shapes: the old one hands out a list of
|
||||
/// capabilities, the new one a profile whose reasoning is a field of its own rather than one of
|
||||
/// three flags. Comparing them at all needs one of the two translated, and translating the new one
|
||||
/// into the old vocabulary is the direction which loses nothing -- the profile knows more, and
|
||||
/// everything the old answer could say has a place in it.
|
||||
/// </remarks>
|
||||
public static class RebuiltRules
|
||||
{
|
||||
/// <summary>
|
||||
/// Asks the rebuilt rules about one corpus entry.
|
||||
/// </summary>
|
||||
/// <param name="entry">The entry to ask about.</param>
|
||||
/// <returns>The capabilities, in the vocabulary the old rules answered in.</returns>
|
||||
public static IReadOnlyList<Capability> Ask(CorpusEntry entry) => AsCapabilities(ModelRegistry.Shared.Profile(entry.Provider, entry.ModelId));
|
||||
|
||||
/// <summary>
|
||||
/// Writes a profile as the list of capabilities the old rules would have answered with.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The reasoning field turns back into the flag which stands for it. That mapping is the whole
|
||||
/// reason the flags stay in the vocabulary: a person writing an override still says
|
||||
/// ALWAYS_REASONING, and the expert dialog still shows those five choices.
|
||||
/// </remarks>
|
||||
/// <param name="profile">The profile to write out.</param>
|
||||
/// <returns>The capabilities.</returns>
|
||||
public static IReadOnlyList<Capability> AsCapabilities(in ModelProfile profile)
|
||||
{
|
||||
// A profile handed in by reference cannot be reached from inside a query, and copying one
|
||||
// costs nothing:
|
||||
var answered = profile;
|
||||
var stated = Enum.GetValues<Capability>()
|
||||
.Where(capability => capability is not Capability.NONE && answered.Has(capability))
|
||||
.ToList();
|
||||
|
||||
var reasoning = ReasoningAsCapability(profile.Reasoning);
|
||||
if (reasoning is not Capability.NONE)
|
||||
stated.Add(reasoning);
|
||||
|
||||
return stated;
|
||||
}
|
||||
|
||||
private static Capability ReasoningAsCapability(ReasoningSupport reasoning) => reasoning switch
|
||||
{
|
||||
ReasoningSupport.OPTIONAL => Capability.OPTIONAL_REASONING,
|
||||
ReasoningSupport.ON_BY_DEFAULT => Capability.REASONING_BY_DEFAULT,
|
||||
ReasoningSupport.ALWAYS => Capability.ALWAYS_REASONING,
|
||||
|
||||
_ => Capability.NONE,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user