mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 11:33:47 +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,95 @@
|
||||
using AIStudio.Provider.HuggingFace;
|
||||
|
||||
namespace AIStudio.Tests.Provider;
|
||||
|
||||
/// <summary>
|
||||
/// Checks which window a model has when it is reached through the Hugging Face router.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The router is the one provider where the window does not belong to the model: the same weights
|
||||
/// run behind several inference providers, each configured by somebody else, and which of them
|
||||
/// answers depends on what the user chose.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public sealed class HFModelTests
|
||||
{
|
||||
private const string AUTOMATIC = "";
|
||||
|
||||
private static readonly HFModel SERVED_BY_THREE = new("deepseek-ai/DeepSeek-R1",
|
||||
[
|
||||
new("novita", "live", 64_000),
|
||||
new("together", "live", 128_000),
|
||||
new("fireworks-ai", "live", 160_000),
|
||||
]);
|
||||
|
||||
[Test]
|
||||
public void AChosenProviderAnswersForItself()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(SERVED_BY_THREE.ContextWindowTokens("novita"), Is.EqualTo(64_000));
|
||||
Assert.That(SERVED_BY_THREE.ContextWindowTokens("together"), Is.EqualTo(128_000));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AChosenProviderIsFoundHoweverItIsSpelled()
|
||||
{
|
||||
Assert.That(SERVED_BY_THREE.ContextWindowTokens("Novita"), Is.EqualTo(64_000));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LettingTheRouterChooseMeansTheSmallestWindowOnOffer()
|
||||
{
|
||||
//
|
||||
// Nobody knows which provider the router will take. Promising the largest window would walk
|
||||
// a conversation into an error the user could not see coming; the smallest one only warns
|
||||
// them earlier than strictly necessary.
|
||||
//
|
||||
Assert.That(SERVED_BY_THREE.ContextWindowTokens(AUTOMATIC), Is.EqualTo(64_000));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AProviderWhichIsNotServingDoesNotDecideAnything()
|
||||
{
|
||||
var oneIsDown = new HFModel("deepseek-ai/DeepSeek-R1",
|
||||
[
|
||||
new("novita", "staging", 8_000),
|
||||
new("together", "live", 128_000),
|
||||
]);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(oneIsDown.ContextWindowTokens(AUTOMATIC), Is.EqualTo(128_000), "The small window belongs to a provider nobody can reach.");
|
||||
Assert.That(oneIsDown.ContextWindowTokens("novita"), Is.Null, "And asking for that provider by name does not bring it back either.");
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AProviderWhichDoesNotServeTheModelSaysNothingAboutIt()
|
||||
{
|
||||
Assert.That(SERVED_BY_THREE.ContextWindowTokens("cerebras"), Is.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AWindowNobodyStatedIsSkippedRatherThanCountedAsNothing()
|
||||
{
|
||||
var halfStated = new HFModel("deepseek-ai/DeepSeek-R1",
|
||||
[
|
||||
new("novita", "live", null),
|
||||
new("together", "live", 128_000),
|
||||
]);
|
||||
|
||||
Assert.That(halfStated.ContextWindowTokens(AUTOMATIC), Is.EqualTo(128_000), "A missing number is not the smallest number.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AModelNobodyServesHasNoWindow()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(new HFModel("org/model", null).ContextWindowTokens(AUTOMATIC), Is.Null);
|
||||
Assert.That(new HFModel("org/model", []).ContextWindowTokens(AUTOMATIC), Is.Null);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user