Port the Mistral open weights and the GLM family

This commit is contained in:
Thorsten Sommer committed 2026-09-11 22:10:40 +02:00
1 parent 9c65ab6c62
commit ad3a25c80f
9 files changed
+215 -7

No files matched your search

@@ -0,0 +1,37 @@
using static AIStudio.Provider.Capability;
namespace AIStudio.Models.Mistral;
/// <summary>
/// The Mistral models which carry no further family name: Mistral 7B, Mistral 3, and their kin.
/// </summary>
/// <remarks>
/// The open weights are where these live. Mistral's own API sells the named ranges -- Small,
/// Medium, Large -- while the plain checkpoints are the ones people run themselves, which is why
/// nothing here is dated: those names carry a size and a quantization instead of a release.
///
/// A substring, and it has to be one: this is the fallback of the whole range, and every family
/// with a name of its own beats it by saying more. What it must not do is claim Ministral or
/// Magistral, and it does not -- neither of those two names contains "mistral".
/// </remarks>
public sealed class MistralFamily : ModelFamily
{
/// <inheritdoc />
public override ModelVendor Vendor => ModelVendor.MISTRAL_AI;
/// <inheritdoc />
public override ModelSource Source => new("https://docs.mistral.ai/getting-started/models/weights/", new DateOnly(2026, 9, 11), "Ported unchanged from the Mistral block of ProviderExtensions.OpenSource.cs: its default answer, and the rule for the 3 line.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder)
{
builder.Rule("mistral").AsSubstring()
.Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING)
.Apis(CHAT_COMPLETION_API);
// The 3 line reads images and thinks when it is asked to:
builder.Rule("mistral-3").AsSegment().Inherits()
.Capabilities(MULTIPLE_IMAGE_INPUT)
.Reasoning(ReasoningSupport.OPTIONAL);
}
}
@@ -49,7 +49,9 @@ public static class MistralReleases
/// <remarks>
/// 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.
/// names carry no release date, so they are mapped onto the release they stand for. Ollama
/// leaves the separator out altogether for the Small checkpoints, which is a third spelling of
/// the same statement.
///
/// 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
@@ -71,6 +73,11 @@ public static class MistralReleases
("mistral-small-3.1", 2503),
("mistral-small-3-1", 2503),
("mistral-small-3", 2501),
("mistral-small4", 2603),
("mistral-small3.2", 2506),
("mistral-small3.1", 2503),
("mistral-small3", 2501),
];
/// <summary>
@@ -5,6 +5,12 @@ namespace AIStudio.Models.Mistral;
/// <summary>
/// Mistral Small, which gained images with 3.1 and reasoning with 4.
/// </summary>
/// <remarks>
/// The one family of the range whose name arrives glued to its version: Ollama publishes the open
/// weights as "mistral-small3.1" and "mistral-small3.2", without the separator Mistral's own API
/// writes. A substring covers both spellings, and it stays specific enough that nothing else in the
/// range can be mistaken for it.
/// </remarks>
public sealed class MistralSmallFamily : MistralReleaseDatedFamily
{
/// <inheritdoc />
@@ -21,7 +27,7 @@ public sealed class MistralSmallFamily : MistralReleaseDatedFamily
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder) =>
builder.Rule("mistral-small").AsSegment()
builder.Rule("mistral-small").AsSubstring()
.Capabilities(WHAT_THEY_COULD_ALWAYS_DO)
.Apis(CHAT_COMPLETION_API);
}