mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-09-14 22:43:38 +00:00
Some checks are pending
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
140 lines
5.1 KiB
C#
140 lines
5.1 KiB
C#
using AIStudio.Models;
|
|
using AIStudio.Models.Hosting;
|
|
using AIStudio.Models.Matching;
|
|
|
|
namespace AIStudio.Tests.Models.Hosting;
|
|
|
|
/// <summary>
|
|
/// Checks how one wrapping is taken off a name.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// All of this works on the name as the provider reported it, never on the normalized one, and
|
|
/// that is the point worth testing: normalizing writes the slash, the colon, and the spaces all as
|
|
/// hyphens, so afterwards there is nothing left to recognize a wrapping by.
|
|
/// </remarks>
|
|
[TestFixture]
|
|
public sealed class HostNamingTests
|
|
{
|
|
[Test]
|
|
public void TheOrganizationComesOffAndSaysWhoBuiltTheModel()
|
|
{
|
|
var taken = HostNaming.TrySplitOrganization(new ModelId("anthropic/claude-opus-5"), out var inner, out var vendor);
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(taken, Is.True);
|
|
Assert.That(inner.Original, Is.EqualTo("claude-opus-5"));
|
|
Assert.That(vendor, Is.EqualTo(ModelVendor.ANTHROPIC));
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void AnOrganizationNobodyRecognizesStatesNoVendorRatherThanAnUnknownOne()
|
|
{
|
|
//
|
|
// "azure" is where the model is running, not who built it. Saying "unknown" here would be a
|
|
// statement, and it would stop the rules from working out the vendor from the name itself.
|
|
//
|
|
var taken = HostNaming.TrySplitOrganization(new ModelId("azure/gpt-5.6"), out var inner, out var vendor);
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(taken, Is.True);
|
|
Assert.That(inner.Original, Is.EqualTo("gpt-5.6"));
|
|
Assert.That(vendor, Is.Null);
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void AnOrganizationIsRecognizedWhicheverWayTheHostSpellsIt()
|
|
{
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(HostNaming.VendorOfOrganization("meta-llama"), Is.EqualTo(ModelVendor.META));
|
|
Assert.That(HostNaming.VendorOfOrganization("Qwen"), Is.EqualTo(ModelVendor.ALIBABA));
|
|
Assert.That(HostNaming.VendorOfOrganization("deepseek-ai"), Is.EqualTo(ModelVendor.DEEP_SEEK));
|
|
Assert.That(HostNaming.VendorOfOrganization("HuggingFaceTB"), Is.EqualTo(ModelVendor.HUGGING_FACE));
|
|
Assert.That(HostNaming.VendorOfOrganization("somebody-else"), Is.EqualTo(ModelVendor.UNKNOWN));
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void ANameWithoutAnOrganizationIsLeftAlone()
|
|
{
|
|
var taken = HostNaming.TrySplitOrganization(new ModelId("llama-3.3-70b-versatile"), out var inner, out var vendor);
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(taken, Is.False);
|
|
Assert.That(inner.Original, Is.EqualTo("llama-3.3-70b-versatile"));
|
|
Assert.That(vendor, Is.Null);
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void OnlyOneSegmentComesOffAtATime()
|
|
{
|
|
//
|
|
// The account path Fireworks puts in front is three segments deep. Nothing here counts
|
|
// them: the walk asks again, which is also what covers the two wrappings of Hugging Face.
|
|
//
|
|
var taken = HostNaming.TrySplitOrganization(new ModelId("accounts/fireworks/models/llama-v3p1-405b-instruct"), out var inner, out _);
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(taken, Is.True);
|
|
Assert.That(inner.Original, Is.EqualTo("fireworks/models/llama-v3p1-405b-instruct"));
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void AnOrganizationWithNothingBehindItIsNotAWrapping()
|
|
{
|
|
var taken = HostNaming.TrySplitOrganization(new ModelId("openai/"), out var inner, out _);
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(taken, Is.False);
|
|
Assert.That(inner.Original, Is.EqualTo("openai/"));
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void TheRoutingSuffixComesOffAndTheModelStaysWhatItWas()
|
|
{
|
|
var taken = HostNaming.TryStripRoutingSuffix(new ModelId("google/gemma-4-31B-it:novita"), out var inner);
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(taken, Is.True);
|
|
Assert.That(inner.Original, Is.EqualTo("google/gemma-4-31B-it"));
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void AMenuPositionComesOff()
|
|
{
|
|
var taken = HostNaming.TryStripMenuPosition(new ModelId("10 - Muse Glimmer 30b - the newest META model"), out var inner);
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(taken, Is.True);
|
|
Assert.That(inner.Original, Is.EqualTo("Muse Glimmer 30b - the newest META model"));
|
|
});
|
|
}
|
|
|
|
[TestCase("70b-instruct", TestName = "A number the model is named after is not a menu position")]
|
|
[TestCase("3-mini", TestName = "A number followed straight by a hyphen is not a menu position")]
|
|
[TestCase("alias-qwen38-27b", TestName = "A name not starting with a number is not a menu position")]
|
|
[TestCase("Qwen 3.8-27B with DFlash on haicluster", TestName = "A sentence without a leading number is not a menu position")]
|
|
public void WhatOnlyLooksLikeAMenuPositionIsLeftAlone(string modelId)
|
|
{
|
|
var taken = HostNaming.TryStripMenuPosition(new ModelId(modelId), out var inner);
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(taken, Is.False);
|
|
Assert.That(inner.Original, Is.EqualTo(modelId));
|
|
});
|
|
}
|
|
} |