diff --git a/app/MindWork AI Studio/Models/Mistral/CodestralFamily.cs b/app/MindWork AI Studio/Models/Mistral/CodestralFamily.cs index c56f1660..90f704aa 100644 --- a/app/MindWork AI Studio/Models/Mistral/CodestralFamily.cs +++ b/app/MindWork AI Studio/Models/Mistral/CodestralFamily.cs @@ -1,3 +1,5 @@ +using AIStudio.Provider; + using static AIStudio.Provider.Capability; namespace AIStudio.Models.Mistral; @@ -10,6 +12,12 @@ namespace AIStudio.Models.Mistral; /// 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. +/// +/// That Mistral serves it to fill in the middle of a file rather than to talk to was the one thing +/// the rebuild left behind: it stayed in the Mistral provider, as a name check which dropped every +/// model whose ID begins with "code". It says something about a model, so it belongs to the model, +/// and it is bound to the provider because it is only true there. Somebody's own server and the +/// gateways serve the same weights to chat with, which is what the unbound rule above keeps saying. /// public sealed class CodestralFamily : ModelFamily { @@ -17,11 +25,22 @@ 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."); + public override ModelSource Source => new("https://docs.mistral.ai/getting-started/models/models_overview/", new DateOnly(2026, 9, 19), "The answer the previous rules gave it through their fallback: text in, text out, tool calling. What Mistral's own catalog makes of it was read from the same page, where Codestral is the model behind the FIM endpoint."); /// - protected override void Declare(ModelFamilyBuilder builder) => + protected override void Declare(ModelFamilyBuilder builder) + { builder.Rule("codestral").AsSegment() .Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING) .Apis(CHAT_COMPLETION_API); + + // + // Bound to Mistral, which makes it the more specific of the two and lets it win there + // without anybody writing an order. It continues a text instead of answering in a + // conversation, so it must not stand among the models somebody picks for a chat. + // + builder.Rule("codestral").AsSegment().OnlyOn(LLMProviders.MISTRAL) + .Inherits() + .Kind(ModelKind.TEXT_COMPLETION); + } } \ No newline at end of file diff --git a/app/Tests/Models/Corpus/CapabilitySnapshot.txt b/app/Tests/Models/Corpus/CapabilitySnapshot.txt index 0e45f251..193254b5 100644 --- a/app/Tests/Models/Corpus/CapabilitySnapshot.txt +++ b/app/Tests/Models/Corpus/CapabilitySnapshot.txt @@ -115,7 +115,7 @@ LITE_LLM | anthropic/claude-sonnet-5 | CHAT_COMPLETION_API, FUNCTION_CALLING, MU LITE_LLM | azure/gpt-5.6 | CHAT_COMPLETION_API, FUNCTION_CALLING, MULTIPLE_IMAGE_INPUT, REASONING_BY_DEFAULT, TEXT_INPUT, TEXT_OUTPUT, WEB_SEARCH | CHAT | 1050000 | (unknown) | TIKTOKEN o200k_base LITE_LLM | bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0 | CHAT_COMPLETION_API, FUNCTION_CALLING, TEXT_INPUT, TEXT_OUTPUT | CHAT | (unknown) | (unknown) | (unknown) LITE_LLM | the-fast-one | CHAT_COMPLETION_API, FUNCTION_CALLING, TEXT_INPUT, TEXT_OUTPUT | CHAT | (unknown) | (unknown) | (unknown) -MISTRAL | codestral-2508 | CHAT_COMPLETION_API, FUNCTION_CALLING, TEXT_INPUT, TEXT_OUTPUT | CHAT | (unknown) | (unknown) | (unknown) +MISTRAL | codestral-2508 | CHAT_COMPLETION_API, FUNCTION_CALLING, TEXT_INPUT, TEXT_OUTPUT | TEXT_COMPLETION | (unknown) | (unknown) | (unknown) MISTRAL | magistral-medium-2506 | ALWAYS_REASONING, CHAT_COMPLETION_API, FUNCTION_CALLING, MULTIPLE_IMAGE_INPUT, TEXT_INPUT, TEXT_OUTPUT | CHAT | (unknown) | (unknown) | (unknown) MISTRAL | ministral-14b-2512 | CHAT_COMPLETION_API, FUNCTION_CALLING, MULTIPLE_IMAGE_INPUT, TEXT_INPUT, TEXT_OUTPUT | CHAT | (unknown) | (unknown) | (unknown) MISTRAL | ministral-3b-latest | CHAT_COMPLETION_API, FUNCTION_CALLING, MULTIPLE_IMAGE_INPUT, TEXT_INPUT, TEXT_OUTPUT | CHAT | (unknown) | (unknown) | (unknown) diff --git a/app/Tests/Models/Corpus/ModelKindCorpus.cs b/app/Tests/Models/Corpus/ModelKindCorpus.cs index 2ac22e86..2998dcd0 100644 --- a/app/Tests/Models/Corpus/ModelKindCorpus.cs +++ b/app/Tests/Models/Corpus/ModelKindCorpus.cs @@ -33,6 +33,11 @@ public static class ModelKindCorpus // The one name whose only marker used to be the organization it was published under: new(SELF_HOSTED, "sentence-transformers/all-MiniLM-L6-v2", EMBEDDING), + + // Mistral's embedding checkpoint for code. It carries the name of a family which is a text + // completion model on this very provider, and stays an embedding model regardless: what a + // model is for is said by the word which says it, not by the family it was built from. + new(MISTRAL, "codestral-embed", EMBEDDING), ]; /// @@ -128,13 +133,18 @@ public static class ModelKindCorpus ]; /// - /// The models from before chat completions existed. + /// The models which continue a text instead of answering in a conversation. /// private static readonly ModelKindExample[] TEXT_COMPLETION_ENTRIES = [ new(HELMHOLTZ, "text-davinci-003", TEXT_COMPLETION), new(OPEN_AI, "babbage-002", TEXT_COMPLETION), new(OPEN_AI, "gpt-3.5-turbo-instruct", TEXT_COMPLETION), + + // The one of these which is not old: Mistral serves Codestral to fill in the middle of a + // file. It says so only for Mistral's own catalog, which is why the open weights of the + // same name stay a chat model further down. + new(MISTRAL, "codestral-latest", TEXT_COMPLETION), ]; /// @@ -179,6 +189,11 @@ public static class ModelKindCorpus new(SELF_HOSTED, "llama3.3:70b", CHAT), new(OPEN_AI, "gpt-5.1", CHAT), + // The open weights of the model Mistral itself serves to fill in the middle of a file. + // Whoever runs them runs them behind a chat completion API, so here the name means + // something to talk to -- which is what binding that other rule to Mistral protects. + new(SELF_HOSTED, "codestral-22b-v0.1", CHAT), + // // Three which were questioned while testing and stay all the same. Grok Build is the coding // model behind the xAI CLI and answers like any other Grok. The Groq compound systems are