Port the remaining open weights we decided to name

This commit is contained in:
Thorsten Sommer committed 2026-09-12 09:41:39 +02:00
1 parent ac547ccb79
commit 7eec39c4a7
15 files changed
+565 -113

No files matched your search

@@ -0,0 +1,30 @@
using static AIStudio.Provider.Capability;
namespace AIStudio.Models.Cohere;
/// <summary>
/// Aya, which comes from Cohere as well and was not built for tools.
/// </summary>
/// <remarks>
/// Their documentation says it in as many words, which is why these are a family of their own
/// rather than a variant of Command: everything the Command rules state would be wrong here.
/// </remarks>
public sealed class AyaFamily : ModelFamily
{
/// <inheritdoc />
public override ModelVendor Vendor => ModelVendor.COHERE;
/// <inheritdoc />
public override ModelSource Source => new("https://docs.cohere.com/docs/aya", new DateOnly(2026, 9, 11), "Ported unchanged from the Aya block of ProviderExtensions.OpenSource.cs.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder)
{
builder.Rule("aya-expanse").AsSubstring()
.Capabilities(TEXT_INPUT | TEXT_OUTPUT)
.Apis(CHAT_COMPLETION_API);
builder.Rule("aya-vision").AsSubstring().Inherits()
.Capabilities(MULTIPLE_IMAGE_INPUT);
}
}
@@ -0,0 +1,41 @@
using static AIStudio.Provider.Capability;
namespace AIStudio.Models.Cohere;
/// <summary>
/// Command, the Cohere line built for tool use.
/// </summary>
/// <remarks>
/// Most of the line calls functions, in one step and in several, so the family states it. Command A
/// Vision is the exception Cohere names outright: tool use is not supported with it.
/// </remarks>
public sealed class CommandFamily : ModelFamily
{
/// <inheritdoc />
public override ModelVendor Vendor => ModelVendor.COHERE;
/// <inheritdoc />
public override ModelSource Source => new("https://docs.cohere.com/docs/models", new DateOnly(2026, 9, 11), "Ported unchanged from the Command block of ProviderExtensions.OpenSource.cs.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder)
{
builder.Rule("command-a").AsSubstring()
.Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING)
.Apis(CHAT_COMPLETION_API);
builder.Rule("command-r").AsSubstring().Inherits();
// Command A+ sees, and thinks unless the request turns the thinking off:
builder.Rule("command-a-plus").AsSubstring().Inherits()
.Capabilities(MULTIPLE_IMAGE_INPUT)
.Reasoning(ReasoningSupport.ON_BY_DEFAULT);
builder.Rule("command-a-reasoning").AsSubstring().InheritsFrom("command-r")
.Reasoning(ReasoningSupport.ON_BY_DEFAULT);
builder.Rule("command-a-vision").AsSubstring()
.Capabilities(TEXT_INPUT | MULTIPLE_IMAGE_INPUT | TEXT_OUTPUT)
.Apis(CHAT_COMPLETION_API);
}
}
@@ -0,0 +1,65 @@
using AIStudio.Provider;
using static AIStudio.Provider.Capability;
namespace AIStudio.Models.IBM;
/// <summary>
/// Granite, from IBM.
/// </summary>
/// <remarks>
/// The instruct line calls functions with the OpenAI function definition schema, so the family
/// states it and the vision checkpoints say otherwise: for those, IBM documents no tool template.
/// The thinking came in two steps -- 3.2 and 3.3 have a toggle which starts off, 4.2 thinks unless
/// the request says otherwise, and the generations in between do not think at all.
///
/// Each generation is written twice. Ollama serves them as "granite4.2:8b", with the version glued
/// to the family name, while IBM writes "granite-4.2". The previous rules knew only IBM's spelling,
/// so everything anybody actually ran through Ollama quietly lost its thinking.
/// </remarks>
public sealed class GraniteFamily : ModelFamily
{
/// <inheritdoc />
public override ModelVendor Vendor => ModelVendor.IBM;
/// <inheritdoc />
public override ModelSource Source => new("https://www.ibm.com/granite/docs/models/granite/", new DateOnly(2026, 9, 11), "Ported from the Granite block of ProviderExtensions.OpenSource.cs, with the spelling Ollama uses added to each generation.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder)
{
builder.Rule("granite").AsSubstring()
.Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING)
.Apis(CHAT_COMPLETION_API);
// The embedding checkpoints turn text into a vector; there is no conversation in them:
builder.Rule("granite-embedding").AsSubstring()
.Capabilities(TEXT_INPUT | EMBEDDING)
.Kind(ModelKind.EMBEDDING);
// The vision checkpoints look at pictures and have nothing to call a function with:
builder.Rule("granite").AsSubstring().AlsoContains("vision")
.Capabilities(TEXT_INPUT | MULTIPLE_IMAGE_INPUT | TEXT_OUTPUT)
.Apis(CHAT_COMPLETION_API);
// From 4.2 on they think unless the request says otherwise:
builder.Rule("granite-4.2").AsSubstring().NotContains("vision")
.Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING)
.Apis(CHAT_COMPLETION_API)
.Reasoning(ReasoningSupport.ON_BY_DEFAULT);
builder.Rule("granite4.2").AsSubstring().NotContains("vision").Inherits();
// 3.2 and 3.3 have to be asked:
builder.Rule("granite-3.2").AsSubstring().NotContains("vision")
.Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING)
.Apis(CHAT_COMPLETION_API)
.Reasoning(ReasoningSupport.OPTIONAL);
builder.Rule("granite3.2").AsSubstring().NotContains("vision").Inherits();
builder.Rule("granite-3.3").AsSubstring().NotContains("vision").Inherits();
builder.Rule("granite3.3").AsSubstring().NotContains("vision").Inherits();
}
}
@@ -0,0 +1,31 @@
using static AIStudio.Provider.Capability;
namespace AIStudio.Models.MiniMax;
/// <summary>
/// MiniMax, whose M line thinks while it works.
/// </summary>
/// <remarks>
/// What MiniMax calls interleaved thinking is reasoning between the tool calls: it is part of the
/// answer rather than something the request switches on, so the M models always think. The older
/// Text-01 answers directly.
/// </remarks>
public sealed class MiniMaxFamily : ModelFamily
{
/// <inheritdoc />
public override ModelVendor Vendor => ModelVendor.MINIMAX;
/// <inheritdoc />
public override ModelSource Source => new("https://huggingface.co/MiniMaxAI", new DateOnly(2026, 9, 11), "Ported unchanged from the MiniMax block of ProviderExtensions.OpenSource.cs.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder)
{
builder.Rule("minimax").AsSubstring()
.Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING)
.Apis(CHAT_COMPLETION_API);
builder.Rule("minimax-m").AsSubstring().Inherits()
.Reasoning(ReasoningSupport.ALWAYS);
}
}
@@ -49,4 +49,5 @@ public enum ModelVendor
SERVICE_NOW,
SHANGHAI_AI_LAB,
SWISS_AI,
NOMIC_AI,
}
@@ -0,0 +1,53 @@
using static AIStudio.Provider.Capability;
namespace AIStudio.Models.MoonshotAI;
/// <summary>
/// Kimi, and the older Moonshot line next to it.
/// </summary>
/// <remarks>
/// Moonshot builds these for agentic work, and the K2 model card says it plainly: pass the tools
/// with the request and the model decides on its own when to call them. So the family states tool
/// calling, and the exception has to say otherwise -- which is the vision checkpoint, the one Kimi
/// no vendor lists among the models which call functions.
///
/// The variants are written for the Kimi names only, because that is where Moonshot puts them. The
/// "moonshot" names are the older API line, which answers straight away and has no variants.
/// </remarks>
public sealed class KimiFamily : ModelFamily
{
/// <inheritdoc />
public override ModelVendor Vendor => ModelVendor.MOONSHOT_AI;
/// <inheritdoc />
public override ModelSource Source => new("https://huggingface.co/moonshotai", new DateOnly(2026, 9, 11), "Ported unchanged from the Moonshot block of ProviderExtensions.OpenSource.cs.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder)
{
builder.Rule("kimi").AsSubstring()
.Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING)
.Apis(CHAT_COMPLETION_API);
builder.Rule("moonshot").AsSubstring().Inherits();
// The thinking variants say what they are in their name:
builder.Rule("kimi").AsSubstring().AlsoContains("thinking").Inherits()
.Reasoning(ReasoningSupport.ALWAYS);
// The vision checkpoint thinks as well, and it is the one which calls nothing:
builder.Rule("kimi-vl").AsSubstring()
.Capabilities(TEXT_INPUT | MULTIPLE_IMAGE_INPUT | TEXT_OUTPUT)
.Apis(CHAT_COMPLETION_API)
.Reasoning(ReasoningSupport.ALWAYS);
builder.Rule("kimi-k2.7-code").AsSubstring()
.Capabilities(TEXT_INPUT | MULTIPLE_IMAGE_INPUT | TEXT_OUTPUT | FUNCTION_CALLING)
.Apis(CHAT_COMPLETION_API)
.Reasoning(ReasoningSupport.ALWAYS);
// The K3 line watches videos on top:
builder.Rule("kimi-k3").AsSubstring().Inherits()
.Capabilities(VIDEO_INPUT);
}
}
@@ -0,0 +1,29 @@
using AIStudio.Provider;
using static AIStudio.Provider.Capability;
namespace AIStudio.Models.Nomic;
/// <summary>
/// The Nomic embedding models, which everybody runs locally and nobody chats with.
/// </summary>
/// <remarks>
/// One of the most widely served models there is: it is what a local setup reaches for when it
/// needs vectors. The previous rules had no idea it existed, so it fell into the assumption that an
/// unknown model chats and calls functions -- three statements about a model which does none of
/// them, and the one thing it does was not said at all.
/// </remarks>
public sealed class NomicEmbedFamily : ModelFamily
{
/// <inheritdoc />
public override ModelVendor Vendor => ModelVendor.NOMIC_AI;
/// <inheritdoc />
public override ModelSource Source => new("https://huggingface.co/nomic-ai", new DateOnly(2026, 9, 11), "The app lists these under IProvider.GetEmbeddingModels, which is where the statement that they embed comes from.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder) =>
builder.Rule("nomic-embed").AsSubstring()
.Capabilities(TEXT_INPUT | EMBEDDING)
.Kind(ModelKind.EMBEDDING);
}
@@ -0,0 +1,30 @@
using static AIStudio.Provider.Capability;
namespace AIStudio.Models.OpenAI;
/// <summary>
/// gpt-oss, the weights OpenAI published.
/// </summary>
/// <remarks>
/// The only OpenAI model anybody else may serve, and the reason the rest of this folder does not
/// have to worry about being confused with it: "gpt-oss" is a name part of its own, while every
/// cloud model of theirs carries a version behind the "gpt". The previous rules needed a function
/// to tell the two apart, and it is the specificity which does it here.
///
/// It browses through the harmony format it was trained on, which is why web search is stated even
/// though nothing else among the open weights has it.
/// </remarks>
public sealed class GptOssFamily : ModelFamily
{
/// <inheritdoc />
public override ModelVendor Vendor => ModelVendor.OPEN_AI;
/// <inheritdoc />
public override ModelSource Source => new("https://huggingface.co/openai/gpt-oss-120b", new DateOnly(2026, 9, 11), "Ported unchanged from the gpt-oss check of ProviderExtensions.OpenSource.cs.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder) =>
builder.Rule("gpt-oss").AsSegment()
.Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING | WEB_SEARCH)
.Apis(CHAT_COMPLETION_API);
}
@@ -0,0 +1,67 @@
using AIStudio.Provider;
using static AIStudio.Provider.Capability;
namespace AIStudio.Models.OpenWeights;
/// <summary>
/// The models we know cannot call functions.
/// </summary>
/// <remarks>
/// Grouped by the one thing they have in common rather than by who built them, because that one
/// thing is the only reason they need a rule at all: a model nobody wrote a rule for is assumed to
/// call functions, and for these that assumption is wrong. None of them documents a tool template
/// -- the publicly funded European models, the discontinued Occiglot, the Yi line whose open
/// weights speak plain ChatML while only the closed Yi-Large-FC calls functions, and the older
/// generations of three families whose newer ones do.
///
/// Two of them have a variant built for tool use, and those step out of the way by name: Salamandra
/// ships one, and so does Falcon-H1. Everything they need is the ordinary assumption, so the rules
/// here simply do not speak for them.
///
/// This is the file which pays for the rest of the open weights not being written down. Whoever
/// runs something we never heard of gets an answer that fits the overwhelming majority of
/// instruction-tuned models, and the handful where that guess goes the wrong way are named here.
/// </remarks>
public sealed class WithoutToolCallingFamily : ModelFamily
{
private const Capability WHAT_A_PLAIN_CHAT_MODEL_DOES = TEXT_INPUT | TEXT_OUTPUT;
/// <inheritdoc />
public override ModelVendor Vendor => ModelVendor.UNKNOWN;
/// <inheritdoc />
public override ModelSource Source => new("https://huggingface.co/docs/hub/en/chat-templates", new DateOnly(2026, 9, 11), "Ported unchanged from the list of models without tool calling in ProviderExtensions.OpenSource.cs, together with the tool-less generations of its OLMo, SmolLM, and Falcon blocks.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder)
{
// The publicly funded European models:
builder.Rule("teuken").AsSubstring()
.Capabilities(WHAT_A_PLAIN_CHAT_MODEL_DOES)
.Apis(CHAT_COMPLETION_API);
builder.Rule("eurollm").AsSubstring().Inherits();
builder.Rule("occiglot").AsSubstring().Inherits();
builder.Rule("salamandra").AsSubstring().NotContains("tools").Inherits();
//
// The Yi line. Written as a name part rather than as a substring, so that the two letters
// do not claim every model which happens to contain them.
//
builder.Rule("yi").AsSegment().Inherits();
// The generations before OLMo 3, SmolLM 3, and Falcon 3, which have no tool template:
builder.Rule("olmo2").AsSubstring().Inherits();
builder.Rule("olmo-2").AsSubstring().Inherits();
builder.Rule("smollm2").AsSubstring().Inherits();
builder.Rule("smollm-2").AsSubstring().Inherits();
builder.Rule("falcon-h1").AsSubstring().NotContains("tool-calling").Inherits();
}
}
@@ -0,0 +1,33 @@
using static AIStudio.Provider.Capability;
namespace AIStudio.Models.Tencent;
/// <summary>
/// Hunyuan, from Tencent.
/// </summary>
/// <remarks>
/// The short name needs a rule of its own because that is how the model arrives: several providers
/// serve it as "tencent/hy3", so looking at the start of the name finds nothing.
///
/// Hy3 answers straight away unless it is asked to think. Its reasoning_effort parameter starts at
/// no_think, and low and high have to be requested.
/// </remarks>
public sealed class HunyuanFamily : ModelFamily
{
/// <inheritdoc />
public override ModelVendor Vendor => ModelVendor.TENCENT;
/// <inheritdoc />
public override ModelSource Source => new("https://huggingface.co/tencent", new DateOnly(2026, 9, 11), "Ported unchanged from the Hunyuan block of ProviderExtensions.OpenSource.cs.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder)
{
builder.Rule("hunyuan").AsSubstring()
.Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING)
.Apis(CHAT_COMPLETION_API)
.Reasoning(ReasoningSupport.OPTIONAL);
builder.Rule("hy3").AsSegment().Inherits();
}
}