From 31a1aec69c91cfd444d00299f7fb6ed4e184f0c7 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 11 Sep 2026 20:33:16 +0200 Subject: [PATCH] Port the Mistral families, including the release date logic --- .../Models/Mistral/CodestralFamily.cs | 27 ++++ .../Models/Mistral/MagistralFamily.cs | 22 +++ .../Models/Mistral/MinistralFamily.cs | 33 +++++ .../Models/Mistral/MistralLargeFamily.cs | 27 ++++ .../Models/Mistral/MistralMediumFamily.cs | 27 ++++ .../Models/Mistral/MistralNemoFamily.cs | 25 ++++ .../Mistral/MistralReleaseDatedFamily.cs | 59 ++++++++ .../Models/Mistral/MistralReleases.cs | 132 ++++++++++++++++++ .../Models/Mistral/MistralSabaFamily.cs | 26 ++++ .../Models/Mistral/MistralSmallFamily.cs | 27 ++++ .../Models/Mistral/PixtralFamily.cs | 24 ++++ .../Models/Mistral/VoxtralFamily.cs | 26 ++++ .../Models/Mistral/MistralReleasesTests.cs | 112 +++++++++++++++ app/Tests/Models/PortingDifferenceTests.cs | 1 + 14 files changed, 568 insertions(+) create mode 100644 app/MindWork AI Studio/Models/Mistral/CodestralFamily.cs create mode 100644 app/MindWork AI Studio/Models/Mistral/MagistralFamily.cs create mode 100644 app/MindWork AI Studio/Models/Mistral/MinistralFamily.cs create mode 100644 app/MindWork AI Studio/Models/Mistral/MistralLargeFamily.cs create mode 100644 app/MindWork AI Studio/Models/Mistral/MistralMediumFamily.cs create mode 100644 app/MindWork AI Studio/Models/Mistral/MistralNemoFamily.cs create mode 100644 app/MindWork AI Studio/Models/Mistral/MistralReleaseDatedFamily.cs create mode 100644 app/MindWork AI Studio/Models/Mistral/MistralReleases.cs create mode 100644 app/MindWork AI Studio/Models/Mistral/MistralSabaFamily.cs create mode 100644 app/MindWork AI Studio/Models/Mistral/MistralSmallFamily.cs create mode 100644 app/MindWork AI Studio/Models/Mistral/PixtralFamily.cs create mode 100644 app/MindWork AI Studio/Models/Mistral/VoxtralFamily.cs create mode 100644 app/Tests/Models/Mistral/MistralReleasesTests.cs diff --git a/app/MindWork AI Studio/Models/Mistral/CodestralFamily.cs b/app/MindWork AI Studio/Models/Mistral/CodestralFamily.cs new file mode 100644 index 00000000..c56f1660 --- /dev/null +++ b/app/MindWork AI Studio/Models/Mistral/CodestralFamily.cs @@ -0,0 +1,27 @@ +using static AIStudio.Provider.Capability; + +namespace AIStudio.Models.Mistral; + +/// +/// Codestral, the Mistral models for writing code. +/// +/// +/// The previous rules never named it. Its name contains neither "mistral" nor any of the other +/// words the Mistral block looked for, so it walked past every rule and reached the answer meant +/// for everything nobody had written one for. That answer happened to describe it correctly, which +/// is why nothing looked wrong -- and is exactly the situation this rebuild is meant to end. +/// +public sealed class CodestralFamily : ModelFamily +{ + /// + public override ModelVendor Vendor => ModelVendor.MISTRAL_AI; + + /// + public override ModelSource Source => new("https://docs.mistral.ai/getting-started/models/models_overview/", new DateOnly(2026, 9, 11), "The answer the previous rules gave it through their fallback: text in, text out, tool calling."); + + /// + protected override void Declare(ModelFamilyBuilder builder) => + builder.Rule("codestral").AsSegment() + .Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING) + .Apis(CHAT_COMPLETION_API); +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Models/Mistral/MagistralFamily.cs b/app/MindWork AI Studio/Models/Mistral/MagistralFamily.cs new file mode 100644 index 00000000..47f7dc94 --- /dev/null +++ b/app/MindWork AI Studio/Models/Mistral/MagistralFamily.cs @@ -0,0 +1,22 @@ +using static AIStudio.Provider.Capability; + +namespace AIStudio.Models.Mistral; + +/// +/// Magistral, the Mistral models which always think before they answer. +/// +public sealed class MagistralFamily : ModelFamily +{ + /// + public override ModelVendor Vendor => ModelVendor.MISTRAL_AI; + + /// + public override ModelSource Source => new("https://docs.mistral.ai/getting-started/models/models_overview/", new DateOnly(2026, 9, 11), "Ported unchanged from the rules in ProviderExtensions.OpenSource.cs: images, tool calling, and thinking which cannot be switched off."); + + /// + protected override void Declare(ModelFamilyBuilder builder) => + builder.Rule("magistral").AsSegment() + .Capabilities(TEXT_INPUT | MULTIPLE_IMAGE_INPUT | TEXT_OUTPUT | FUNCTION_CALLING) + .Apis(CHAT_COMPLETION_API) + .Reasoning(ReasoningSupport.ALWAYS); +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Models/Mistral/MinistralFamily.cs b/app/MindWork AI Studio/Models/Mistral/MinistralFamily.cs new file mode 100644 index 00000000..60e64509 --- /dev/null +++ b/app/MindWork AI Studio/Models/Mistral/MinistralFamily.cs @@ -0,0 +1,33 @@ +using static AIStudio.Provider.Capability; + +namespace AIStudio.Models.Mistral; + +/// +/// Ministral, the small ones, which see from the third generation on and never reason. +/// +/// +/// The name is one letter away from the rest of the range and shares no name part with it, which +/// the previous rules had to say out loud: the Ministral check sat above the Mistral block because +/// "ministral" does not contain "mistral". Here that is not a question anybody has to ask -- the +/// rules answer for the name part they were written for and for no other. +/// +public sealed class MinistralFamily : MistralReleaseDatedFamily +{ + /// + public override ModelSource Source => new("https://docs.mistral.ai/getting-started/models/models_overview/", new DateOnly(2026, 9, 11), "Ported unchanged from the rules in ProviderExtensions.Mistral.cs: images from Ministral 3 on, and no reasoning in any release."); + + /// + protected override int VisionSince => 2512; + + /// + protected override int ReasoningSince => MistralReleases.NEVER; + + /// + protected override int LatestRelease => 2512; + + /// + protected override void Declare(ModelFamilyBuilder builder) => + builder.Rule("ministral").AsSegment() + .Capabilities(WHAT_THEY_COULD_ALWAYS_DO) + .Apis(CHAT_COMPLETION_API); +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Models/Mistral/MistralLargeFamily.cs b/app/MindWork AI Studio/Models/Mistral/MistralLargeFamily.cs new file mode 100644 index 00000000..83c9de37 --- /dev/null +++ b/app/MindWork AI Studio/Models/Mistral/MistralLargeFamily.cs @@ -0,0 +1,27 @@ +using static AIStudio.Provider.Capability; + +namespace AIStudio.Models.Mistral; + +/// +/// Mistral Large, which learned to see and to think with the same release. +/// +public sealed class MistralLargeFamily : MistralReleaseDatedFamily +{ + /// + public override ModelSource Source => new("https://docs.mistral.ai/getting-started/models/models_overview/", new DateOnly(2026, 9, 11), "Ported unchanged from the rules in ProviderExtensions.Mistral.cs: images and reasoning from Mistral Large 3 on."); + + /// + protected override int VisionSince => 2512; + + /// + protected override int ReasoningSince => 2512; + + /// + protected override int LatestRelease => 2512; + + /// + protected override void Declare(ModelFamilyBuilder builder) => + builder.Rule("mistral-large").AsSegment() + .Capabilities(WHAT_THEY_COULD_ALWAYS_DO) + .Apis(CHAT_COMPLETION_API); +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Models/Mistral/MistralMediumFamily.cs b/app/MindWork AI Studio/Models/Mistral/MistralMediumFamily.cs new file mode 100644 index 00000000..aced6ad3 --- /dev/null +++ b/app/MindWork AI Studio/Models/Mistral/MistralMediumFamily.cs @@ -0,0 +1,27 @@ +using static AIStudio.Provider.Capability; + +namespace AIStudio.Models.Mistral; + +/// +/// Mistral Medium, which could see for almost a year before it could think. +/// +public sealed class MistralMediumFamily : MistralReleaseDatedFamily +{ + /// + public override ModelSource Source => new("https://docs.mistral.ai/getting-started/models/models_overview/", new DateOnly(2026, 9, 11), "Ported unchanged from the rules in ProviderExtensions.Mistral.cs: images from Mistral Medium 3 on, reasoning from Mistral Medium 3.5 on."); + + /// + protected override int VisionSince => 2505; + + /// + protected override int ReasoningSince => 2604; + + /// + protected override int LatestRelease => 2604; + + /// + protected override void Declare(ModelFamilyBuilder builder) => + builder.Rule("mistral-medium").AsSegment() + .Capabilities(WHAT_THEY_COULD_ALWAYS_DO) + .Apis(CHAT_COMPLETION_API); +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Models/Mistral/MistralNemoFamily.cs b/app/MindWork AI Studio/Models/Mistral/MistralNemoFamily.cs new file mode 100644 index 00000000..32952081 --- /dev/null +++ b/app/MindWork AI Studio/Models/Mistral/MistralNemoFamily.cs @@ -0,0 +1,25 @@ +using static AIStudio.Provider.Capability; + +namespace AIStudio.Models.Mistral; + +/// +/// Mistral NeMo, the open model Mistral built with NVIDIA. +/// +/// +/// Mistral's own API serves it as "open-mistral-nemo", the hubs as "mistral-nemo". Whole name +/// parts cover both, which is why nothing here cares which of the two arrived. +/// +public sealed class MistralNemoFamily : ModelFamily +{ + /// + public override ModelVendor Vendor => ModelVendor.MISTRAL_AI; + + /// + public override ModelSource Source => new("https://docs.mistral.ai/getting-started/models/models_overview/", new DateOnly(2026, 9, 11), "Ported unchanged from the rules in ProviderExtensions.OpenSource.cs: text in, text out, tool calling."); + + /// + protected override void Declare(ModelFamilyBuilder builder) => + builder.Rule("mistral-nemo").AsSegment() + .Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING) + .Apis(CHAT_COMPLETION_API); +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Models/Mistral/MistralReleaseDatedFamily.cs b/app/MindWork AI Studio/Models/Mistral/MistralReleaseDatedFamily.cs new file mode 100644 index 00000000..8d96c8c4 --- /dev/null +++ b/app/MindWork AI Studio/Models/Mistral/MistralReleaseDatedFamily.cs @@ -0,0 +1,59 @@ +using AIStudio.Models.Matching; +using AIStudio.Provider; + +namespace AIStudio.Models.Mistral; + +/// +/// A Mistral family whose abilities depend on when the model was released rather than on its name. +/// +/// +/// This is the case the refinement exists for. Four Mistral families gained image input and +/// reasoning at some release and carried the same name before and after, so no pattern can tell +/// the two apart: mistral-large-2411 and mistral-large-2512 differ in what they can do and in +/// nothing a rule could match on. +/// +/// So the rule states what the family has always been able to do, and each family says from which +/// release on it gained the rest. Everything shared sits here; a family below is three numbers and +/// one rule. +/// +public abstract class MistralReleaseDatedFamily : ModelFamily +{ + /// + /// What every one of these families could do from its very first release. + /// + protected const Capability WHAT_THEY_COULD_ALWAYS_DO = Capability.TEXT_INPUT | Capability.TEXT_OUTPUT | Capability.FUNCTION_CALLING; + + /// + public override ModelVendor Vendor => ModelVendor.MISTRAL_AI; + + /// + /// The release from which this family accepts images. + /// + protected abstract int VisionSince { get; } + + /// + /// The release from which this family can reason, or never. + /// + protected abstract int ReasoningSince { get; } + + /// + /// The release this family's "latest" alias currently points at. + /// + /// + /// Mistral moves the alias on with every release, so it has to behave like the release it + /// resolves to instead of carrying rules of its own. + /// + protected abstract int LatestRelease { get; } + + /// + public override ModelProfile Refine(in ModelId id, in ModelProfile selected) + { + var release = MistralReleases.Of(id, this.LatestRelease); + + return selected with + { + Capabilities = release >= this.VisionSince ? selected.Capabilities | Capability.MULTIPLE_IMAGE_INPUT : selected.Capabilities, + Reasoning = release >= this.ReasoningSince ? ReasoningSupport.OPTIONAL : selected.Reasoning, + }; + } +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Models/Mistral/MistralReleases.cs b/app/MindWork AI Studio/Models/Mistral/MistralReleases.cs new file mode 100644 index 00000000..2d15e220 --- /dev/null +++ b/app/MindWork AI Studio/Models/Mistral/MistralReleases.cs @@ -0,0 +1,132 @@ +using AIStudio.Models.Matching; + +namespace AIStudio.Models.Mistral; + +/// +/// Reads the release a Mistral model belongs to out of its name. +/// +/// +/// Mistral names its models after the month they came out: mistral-large-2512 is Mistral Large 3 +/// from December 2025. The marketing version lives in the marketing name only, so a rule written +/// against it would miss nearly every model the API actually serves. What a family can state is +/// therefore not "this model reads images" but "this family reads images from this release on", +/// and that is a calculation, not a pattern -- which is what the families do in Refine. +/// +public static class MistralReleases +{ + /// + /// A threshold no release can ever reach, for a family which never gained the ability at all. + /// + public const int NEVER = int.MaxValue; + + /// + /// What a name says when it carries no release at all. + /// + /// + /// Nothing is granted for it. That is the safe direction: offering an ability the model does + /// not have makes the request fail, while a missing one can be handed back by a person through + /// the expert settings. + /// + public const int UNKNOWN = 0; + + /// + /// How many digits a release is written with. + /// + private const int RELEASE_LENGTH = 4; + + /// + /// Mistral released its first date-named model in 2023. + /// + /// + /// Anything below that is not a release date but a parameter count or a context size which + /// happens to have four digits. + /// + private const int FIRST_RELEASE_YEAR = 23; + + /// + /// The releases the marketing versions stand for. + /// + /// + /// Mistral serves some models under their marketing version as well, and writes the version + /// separator both ways: mistral-medium-3.5 and mistral-medium-3-5 are the same model. Those + /// names carry no release date, so they are mapped onto the release they stand for. + /// + /// The order matters, and it is the one place in this rebuild where it still does: these are + /// read as plain text rather than as patterns, so "mistral-medium-3" would answer for + /// "mistral-medium-3.5" if it came first. + /// + private static readonly (string VersionName, int Release)[] VERSION_NAMES = + [ + ("mistral-large-3", 2512), + + ("mistral-medium-3.5", 2604), + ("mistral-medium-3-5", 2604), + ("mistral-medium-3.1", 2508), + ("mistral-medium-3-1", 2508), + ("mistral-medium-3", 2505), + + ("mistral-small-4", 2603), + ("mistral-small-3.2", 2506), + ("mistral-small-3-2", 2506), + ("mistral-small-3.1", 2503), + ("mistral-small-3-1", 2503), + ("mistral-small-3", 2501), + ]; + + /// + /// The release a model name belongs to. + /// + /// The model name. + /// The release this family's "latest" alias currently points at. + /// The release as YYMM, or unknown. + public static int Of(in ModelId id, int latestRelease) + { + // The "latest" alias always points at the newest release of its family: + if (id.ContainsSegments("latest")) + return latestRelease; + + foreach (var (versionName, release) in VERSION_NAMES) + if (id.ContainsText(versionName)) + return release; + + return ReadFrom(id.Normalized.AsSpan()); + } + + /// + /// Reads the four-digit release out of a name. + /// + /// + /// The block has to be exactly four digits long and has to read as a plausible year and month. + /// Without that, the size of a model would be mistaken for its release: ministral-14b-2512 has + /// to resolve to 2512 and not to anything the "14b" part could be read as. + /// + /// The normalized model name. + /// The release as YYMM, or unknown. + private static int ReadFrom(ReadOnlySpan modelName) + { + for (var index = 0; index + RELEASE_LENGTH <= modelName.Length; index++) + { + // A digit next to the block means the block is longer than four digits: + if (index > 0 && char.IsAsciiDigit(modelName[index - 1])) + continue; + + if (index + RELEASE_LENGTH < modelName.Length && char.IsAsciiDigit(modelName[index + RELEASE_LENGTH])) + continue; + + var candidate = modelName.Slice(index, RELEASE_LENGTH); + if (!char.IsAsciiDigit(candidate[0]) || !char.IsAsciiDigit(candidate[1]) || + !char.IsAsciiDigit(candidate[2]) || !char.IsAsciiDigit(candidate[3])) + continue; + + var release = int.Parse(candidate); + var year = release / 100; + var month = release % 100; + if (year < FIRST_RELEASE_YEAR || month is < 1 or > 12) + continue; + + return release; + } + + return UNKNOWN; + } +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Models/Mistral/MistralSabaFamily.cs b/app/MindWork AI Studio/Models/Mistral/MistralSabaFamily.cs new file mode 100644 index 00000000..14fc05cb --- /dev/null +++ b/app/MindWork AI Studio/Models/Mistral/MistralSabaFamily.cs @@ -0,0 +1,26 @@ +using static AIStudio.Provider.Capability; + +namespace AIStudio.Models.Mistral; + +/// +/// Mistral Saba, the regional model for the Middle East and South Asia. +/// +/// +/// The one Mistral in this range which calls no tools at all. It needs its own rule for that +/// reason alone: without it, the length of "mistral-small" and "mistral-large" would not matter, +/// but the shape they share would be handed to a model which does not have it. +/// +public sealed class MistralSabaFamily : ModelFamily +{ + /// + public override ModelVendor Vendor => ModelVendor.MISTRAL_AI; + + /// + public override ModelSource Source => new("https://docs.mistral.ai/getting-started/models/models_overview/", new DateOnly(2026, 9, 11), "Ported unchanged from the rules in ProviderExtensions.Mistral.cs: text in, text out, and nothing else."); + + /// + protected override void Declare(ModelFamilyBuilder builder) => + builder.Rule("mistral-saba").AsSegment() + .Capabilities(TEXT_INPUT | TEXT_OUTPUT) + .Apis(CHAT_COMPLETION_API); +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Models/Mistral/MistralSmallFamily.cs b/app/MindWork AI Studio/Models/Mistral/MistralSmallFamily.cs new file mode 100644 index 00000000..886df374 --- /dev/null +++ b/app/MindWork AI Studio/Models/Mistral/MistralSmallFamily.cs @@ -0,0 +1,27 @@ +using static AIStudio.Provider.Capability; + +namespace AIStudio.Models.Mistral; + +/// +/// Mistral Small, which gained images with 3.1 and reasoning with 4. +/// +public sealed class MistralSmallFamily : MistralReleaseDatedFamily +{ + /// + public override ModelSource Source => new("https://docs.mistral.ai/getting-started/models/models_overview/", new DateOnly(2026, 9, 11), "Ported unchanged from the rules in ProviderExtensions.Mistral.cs: images from Mistral Small 3.1 on, reasoning from Mistral Small 4 on."); + + /// + protected override int VisionSince => 2503; + + /// + protected override int ReasoningSince => 2603; + + /// + protected override int LatestRelease => 2603; + + /// + protected override void Declare(ModelFamilyBuilder builder) => + builder.Rule("mistral-small").AsSegment() + .Capabilities(WHAT_THEY_COULD_ALWAYS_DO) + .Apis(CHAT_COMPLETION_API); +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Models/Mistral/PixtralFamily.cs b/app/MindWork AI Studio/Models/Mistral/PixtralFamily.cs new file mode 100644 index 00000000..31047687 --- /dev/null +++ b/app/MindWork AI Studio/Models/Mistral/PixtralFamily.cs @@ -0,0 +1,24 @@ +using static AIStudio.Provider.Capability; + +namespace AIStudio.Models.Mistral; + +/// +/// Pixtral, the Mistral models built to look at pictures. +/// +/// +/// They read images from the first release, so nothing here depends on a date. +/// +public sealed class PixtralFamily : ModelFamily +{ + /// + public override ModelVendor Vendor => ModelVendor.MISTRAL_AI; + + /// + public override ModelSource Source => new("https://docs.mistral.ai/getting-started/models/models_overview/", new DateOnly(2026, 9, 11), "Ported unchanged from the rules in ProviderExtensions.Mistral.cs: images in every release."); + + /// + protected override void Declare(ModelFamilyBuilder builder) => + builder.Rule("pixtral").AsSegment() + .Capabilities(TEXT_INPUT | MULTIPLE_IMAGE_INPUT | TEXT_OUTPUT | FUNCTION_CALLING) + .Apis(CHAT_COMPLETION_API); +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Models/Mistral/VoxtralFamily.cs b/app/MindWork AI Studio/Models/Mistral/VoxtralFamily.cs new file mode 100644 index 00000000..7bcfaf0b --- /dev/null +++ b/app/MindWork AI Studio/Models/Mistral/VoxtralFamily.cs @@ -0,0 +1,26 @@ +using static AIStudio.Provider.Capability; + +namespace AIStudio.Models.Mistral; + +/// +/// Voxtral, the Mistral models which listen. +/// +/// +/// They take speech as input and answer in text, which makes them neither a chat model nor a +/// transcription model but something in between: they understand what was said rather than only +/// writing it down. +/// +public sealed class VoxtralFamily : ModelFamily +{ + /// + public override ModelVendor Vendor => ModelVendor.MISTRAL_AI; + + /// + public override ModelSource Source => new("https://docs.mistral.ai/getting-started/models/models_overview/", new DateOnly(2026, 9, 11), "Ported unchanged from the rules in ProviderExtensions.OpenSource.cs: speech in, text out, tool calling."); + + /// + protected override void Declare(ModelFamilyBuilder builder) => + builder.Rule("voxtral").AsSegment() + .Capabilities(TEXT_INPUT | SPEECH_INPUT | TEXT_OUTPUT | FUNCTION_CALLING) + .Apis(CHAT_COMPLETION_API); +} \ No newline at end of file diff --git a/app/Tests/Models/Mistral/MistralReleasesTests.cs b/app/Tests/Models/Mistral/MistralReleasesTests.cs new file mode 100644 index 00000000..289e3ce8 --- /dev/null +++ b/app/Tests/Models/Mistral/MistralReleasesTests.cs @@ -0,0 +1,112 @@ +using AIStudio.Models; +using AIStudio.Models.Matching; +using AIStudio.Models.Mistral; +using AIStudio.Models.Registry; +using AIStudio.Provider; + +namespace AIStudio.Tests.Models.Mistral; + +/// +/// Checks how a Mistral release is read out of a model name. +/// +/// +/// This is the one place in the rebuilt rules where a capability is calculated rather than stated. +/// Mistral names its models after the month they came out, and the same family name stands for +/// models which can and cannot see -- so nothing a pattern could match on tells them apart. +/// +/// What makes it worth its own tests is that model names are full of four-digit numbers which are +/// not dates: parameter counts, context sizes, versions. Reading one of those as a release would +/// silently promise image input for a model which has none. +/// +[TestFixture] +public sealed class MistralReleasesTests +{ + /// + /// A release far enough in the future that no name in these tests reaches it by accident. + /// + private const int SOME_LATEST_RELEASE = 2604; + + [TestCase("mistral-large-2512", ExpectedResult = 2512, TestName = "The release is read from the end of the name")] + [TestCase("ministral-14b-2512", ExpectedResult = 2512, TestName = "The size of a model is not its release")] + [TestCase("ministral-8b-2410", ExpectedResult = 2410, TestName = "A one digit size next to the release is not part of it")] + [TestCase("something-25120", ExpectedResult = MistralReleases.UNKNOWN, TestName = "A five digit block is not a release")] + [TestCase("something-125120", ExpectedResult = MistralReleases.UNKNOWN, TestName = "A six digit block is not a release either")] + [TestCase("something-1912", ExpectedResult = MistralReleases.UNKNOWN, TestName = "A year before Mistral named models after dates is not a release")] + [TestCase("something-2513", ExpectedResult = MistralReleases.UNKNOWN, TestName = "A thirteenth month is not a release")] + [TestCase("something-2500", ExpectedResult = MistralReleases.UNKNOWN, TestName = "A zeroth month is not a release")] + [TestCase("open-mistral-nemo", ExpectedResult = MistralReleases.UNKNOWN, TestName = "A name without any number carries no release")] + public int TheReleaseIsReadOnlyWhereThereIsOne(string modelId) => MistralReleases.Of(new ModelId(modelId), SOME_LATEST_RELEASE); + + [Test] + public void TheLatestAliasBecomesWhateverItsFamilyPointsAt() + { + var release = MistralReleases.Of(new ModelId("mistral-large-latest"), SOME_LATEST_RELEASE); + + Assert.That(release, Is.EqualTo(SOME_LATEST_RELEASE)); + } + + [Test] + public void AMarketingVersionBecomesTheReleaseItStandsFor() + { + // + // And the more specific one has to win: read as plain text rather than as patterns, a rule + // for "mistral-medium-3" would otherwise answer for "mistral-medium-3.5" as well and place + // it eleven months too early, before the release which gave it reasoning. + // + Assert.Multiple(() => + { + Assert.That(MistralReleases.Of(new ModelId("mistral-medium-3"), SOME_LATEST_RELEASE), Is.EqualTo(2505)); + Assert.That(MistralReleases.Of(new ModelId("mistral-medium-3.5"), SOME_LATEST_RELEASE), Is.EqualTo(2604)); + Assert.That(MistralReleases.Of(new ModelId("mistral-medium-3-5"), SOME_LATEST_RELEASE), Is.EqualTo(2604), "Mistral writes the version separator both ways for the same model."); + }); + } + + [Test] + public void OneFamilyAnswersDifferentlyForTwoOfItsOwnReleases() + { + // + // The point of the whole calculation, in one assertion: both names select the same family + // and the same rule, and the model differs. + // + var beforeItCouldSee = ModelRegistry.Shared.Profile(LLMProviders.MISTRAL, "mistral-large-2411"); + var afterwards = ModelRegistry.Shared.Profile(LLMProviders.MISTRAL, "mistral-large-2512"); + + Assert.Multiple(() => + { + Assert.That(beforeItCouldSee.Has(Capability.MULTIPLE_IMAGE_INPUT), Is.False); + Assert.That(beforeItCouldSee.Reasoning, Is.EqualTo(ReasoningSupport.NONE)); + + Assert.That(afterwards.Has(Capability.MULTIPLE_IMAGE_INPUT), Is.True); + Assert.That(afterwards.Reasoning, Is.EqualTo(ReasoningSupport.OPTIONAL)); + }); + } + + [Test] + public void AReleaseWhichCannotBeReadGrantsNothing() + { + // + // The safe direction: offering an ability the model does not have makes the request fail, + // while a missing one can be handed back by a person through the expert settings. + // + var profile = ModelRegistry.Shared.Profile(LLMProviders.MISTRAL, "mistral-large-whenever"); + + Assert.Multiple(() => + { + Assert.That(profile.Has(Capability.FUNCTION_CALLING), Is.True, "What the family could always do is still stated."); + Assert.That(profile.Has(Capability.MULTIPLE_IMAGE_INPUT), Is.False); + Assert.That(profile.Reasoning, Is.EqualTo(ReasoningSupport.NONE)); + }); + } + + [Test] + public void AFamilyWhichNeverReasonedDoesNotStartWithItsNewestRelease() + { + var newest = ModelRegistry.Shared.Profile(LLMProviders.MISTRAL, "ministral-3b-latest"); + + Assert.Multiple(() => + { + Assert.That(newest.Has(Capability.MULTIPLE_IMAGE_INPUT), Is.True, "Ministral 3 reads images."); + Assert.That(newest.Reasoning, Is.EqualTo(ReasoningSupport.NONE), "No Ministral reasons, whatever its release."); + }); + } +} \ No newline at end of file diff --git a/app/Tests/Models/PortingDifferenceTests.cs b/app/Tests/Models/PortingDifferenceTests.cs index 405ef85d..02b21076 100644 --- a/app/Tests/Models/PortingDifferenceTests.cs +++ b/app/Tests/Models/PortingDifferenceTests.cs @@ -32,6 +32,7 @@ public sealed class PortingDifferenceTests LLMProviders.OPEN_AI, LLMProviders.ANTHROPIC, LLMProviders.GOOGLE, + LLMProviders.MISTRAL, ]; [Test]