Keep non-chat models out of the chat lists

This commit is contained in:
Thorsten Sommer 2026-09-12 13:51:54 +02:00
parent 77130a450a
commit b6defc8b4b
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
11 changed files with 111 additions and 5 deletions

View File

@ -0,0 +1,25 @@
using AIStudio.Provider;
namespace AIStudio.Models.Kinds;
/// <summary>
/// The models that work a screen instead of holding a conversation.
/// </summary>
/// <remarks>
/// They are named after the chat model they grew out of -- gemini-2.5-computer-use-preview -- and a
/// name is all they share with it. A request without the computer use tool is refused outright:
/// "This model requires the use of the Computer Use tool." So the resemblance is exactly the trap,
/// and this is the rule that keeps them out of the list a person picks a chat partner from.
/// </remarks>
public sealed class ComputerUseModelsFamily : ModelFamily
{
/// <inheritdoc />
public override ModelVendor Vendor => ModelVendor.UNKNOWN;
/// <inheritdoc />
public override ModelSource Source => new("https://ai.google.dev/gemini-api/docs/computer-use", new DateOnly(2026, 9, 12), "Found while testing the switch-over: the model stood in the chat list although its API refuses every request which does not carry the computer use tool.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder) =>
builder.Modifier("computer-use").AsSegment().Kind(ModelKind.COMPUTER_USE);
}

View File

@ -35,5 +35,8 @@ public sealed class ImageGenerationModelsFamily : ModelFamily
builder.Modifier("midjourney").AsSubstring().Inherits();
builder.Modifier("image").AsSegment().Inherits();
// The other half of Grok Imagine, which the video rule steps aside for:
builder.Modifier("grok-imagine").AsSegment().NotContains("video").Inherits();
}
}

View File

@ -23,11 +23,20 @@ public sealed class RealtimeModelsFamily : ModelFamily
public override ModelVendor Vendor => ModelVendor.UNKNOWN;
/// <inheritdoc />
public override ModelSource Source => new("https://platform.openai.com/docs/guides/realtime", new DateOnly(2026, 9, 12), "Ported from the realtime marker of Provider/ModelKindExtensions.cs, where the same precedence was written as the order of two if statements.");
public override ModelSource Source => new("https://developers.openai.com/api/docs/models/gpt-live-1", new DateOnly(2026, 9, 12), "Ported from the realtime marker of Provider/ModelKindExtensions.cs, where the same precedence was written as the order of two if statements. GPT-Live was added after it turned up in the chat list while testing.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder) =>
protected override void Declare(ModelFamilyBuilder builder)
{
builder.Modifier("realtime").AsSubstring()
.Rank(1, THE_CONNECTION_DECIDES)
.Kind(ModelKind.REALTIME);
//
// The line which dropped the word. GPT-Live listens and speaks at the same time and leaves
// the thinking to a text model behind it, so there is even less of a conversation in it than
// in the realtime models it succeeds -- and nothing in the name says so any more.
//
builder.Modifier("gpt-live").AsSegment().Inherits();
}
}

View File

@ -18,7 +18,7 @@ public sealed class VideoGenerationModelsFamily : ModelFamily
public override ModelVendor Vendor => ModelVendor.UNKNOWN;
/// <inheritdoc />
public override ModelSource Source => new("https://huggingface.co/models?pipeline_tag=text-to-video", new DateOnly(2026, 9, 12), "Ported from the video generation markers of Provider/ModelKindExtensions.cs, where veo carried a trailing hyphen to say the same thing a name part says here.");
public override ModelSource Source => new("https://huggingface.co/models?pipeline_tag=text-to-video", new DateOnly(2026, 9, 12), "Ported from the video generation markers of Provider/ModelKindExtensions.cs, where veo carried a trailing hyphen to say the same thing a name part says here. Grok Imagine was added after it turned up in the chat list while testing; see https://docs.x.ai/docs/models.");
/// <inheritdoc />
protected override void Declare(ModelFamilyBuilder builder)
@ -32,5 +32,8 @@ public sealed class VideoGenerationModelsFamily : ModelFamily
builder.Modifier("veo").AsSegment().Inherits();
builder.Modifier("kling").AsSegment().Inherits();
// Grok Imagine makes both stills and film; the word next to it says which:
builder.Modifier("grok-imagine").AsSegment().AlsoContains("video").Inherits();
}
}

View File

@ -34,6 +34,14 @@ public sealed class GrokFamily : ModelFamily
.Capabilities(TEXT_INPUT | MULTIPLE_IMAGE_INPUT | TEXT_OUTPUT)
.Apis(CHAT_COMPLETION_API);
//
// Grok Build is the agentic coding model behind their CLI. It reads pictures, which the
// family fallback does not know about, and it does not think out loud.
//
builder.Rule("grok-build").AsPrefix()
.Capabilities(TEXT_INPUT | MULTIPLE_IMAGE_INPUT | TEXT_OUTPUT | FUNCTION_CALLING)
.Apis(CHAT_COMPLETION_API);
builder.Rule("grok-3-mini").AsPrefix()
.Capabilities(TEXT_INPUT | TEXT_OUTPUT | FUNCTION_CALLING)
.Apis(CHAT_COMPLETION_API)

View File

@ -168,9 +168,15 @@ public class ProviderGoogle() : BaseProvider(LLMProviders.GOOGLE, new Uri("https
{
Models =
[
//
// Asking what a model is made for, rather than only ruling out the embedding ones.
// Google names everything after the chat model it grew out of, so the catalog is
// full of names which look like something to talk to and are not: the image models,
// and the computer use model whose API refuses a request without its tool.
//
..result.Models.Where(model =>
model.Id.StartsWith("gemini-", StringComparison.OrdinalIgnoreCase) &&
!model.IsEmbeddingModel())
model.IsChatModel())
.Select(this.WithDisplayNameFallback)
]
};

View File

@ -76,6 +76,16 @@ public enum ModelKind
/// </remarks>
REALTIME,
/// <summary>
/// The model drives a computer: it looks at a screen and says what to click next.
/// </summary>
/// <remarks>
/// These refuse a plain conversation outright. Google's answer to a request without the computer
/// use tool is "This model requires the use of the Computer Use tool", so the model belongs in no
/// chat list, however much its name looks like the chat model it grew out of.
/// </remarks>
COMPUTER_USE,
/// <summary>
/// The model extracts text from images or scanned documents.
/// </summary>

View File

@ -79,7 +79,12 @@ public sealed class ProviderX() : BaseProvider(LLMProviders.X, new Uri("https://
var result = await this.LoadModels(SecretStoreType.LLM_PROVIDER, ["grok-"], apiKeyProvisional, token);
return result with
{
Models = [..result.Models.Where(n => !n.Id.Contains("-image", StringComparison.OrdinalIgnoreCase))]
//
// Asking what a model is made for rather than testing its name for a word. The word was
// "-image", which said nothing about grok-imagine-video: that one made films and stood
// in the list of things to chat with.
//
Models = [..result.Models.Where(model => model.IsChatModel())]
};
}

View File

@ -168,5 +168,14 @@ public static class ExpectedChanges
AnswerWanted: [TEXT_INPUT, MULTIPLE_IMAGE_INPUT, TEXT_OUTPUT, FUNCTION_CALLING, WEB_SEARCH, RESPONSES_API],
Reason: "The alias for the non-reasoning GPT-5 is claimed by the \"gpt-5-\" prefix rule and is told it always reasons, which is the one thing its name rules out.",
Source: "OpenAI names this alias as the non-reasoning model of the GPT-5 line; the corpus entry \"gpt-5\" next to it is the reasoning one."),
//
// A model nobody had written a rule for yet, found while testing the switch-over.
//
new(X, "grok-build-0.1",
AnswerToday: [TEXT_INPUT, TEXT_OUTPUT, FUNCTION_CALLING, CHAT_COMPLETION_API],
AnswerWanted: [TEXT_INPUT, MULTIPLE_IMAGE_INPUT, TEXT_OUTPUT, FUNCTION_CALLING, CHAT_COMPLETION_API],
Reason: "The agentic coding model of the Grok line reads pictures, and the family fallback it reaches says text only.",
Source: "https://x.ai/news/grok-build-0-1 states text and image input, tool calling, and a 256K context window."),
];
}

View File

@ -204,6 +204,7 @@ public static class ModelCorpus
new(X, "grok-3-mini", NAMED_BY_A_RULE),
new(X, "grok-2-vision-1212", NAMED_BY_A_RULE),
new(X, "grok-5", NAMED_BY_NO_RULE),
new(X, "grok-build-0.1", NAMED_BY_A_RULE),
];
/// <summary>

View File

@ -69,6 +69,9 @@ public static class ModelKindCorpus
new(OPEN_AI, "sora-2", VIDEO_GENERATION),
new(GOOGLE, "veo-3.0-generate-001", VIDEO_GENERATION),
new(SELF_HOSTED, "kling-video-v2", VIDEO_GENERATION),
new(X, "grok-imagine-video", VIDEO_GENERATION, AnsweredTodayAs: CHAT, Reason: "Found in the chat list while testing. No marker knew the name, and the xAI provider only kept models whose name lacks \"-image\" -- which \"-imagine\" does."),
new(X, "grok-imagine-video-1.5", VIDEO_GENERATION, AnsweredTodayAs: CHAT, Reason: "The same, one version on."),
];
/// <summary>
@ -108,6 +111,16 @@ public static class ModelKindCorpus
// The name the marker file names as the reason for asking this question before the others:
new(OPEN_AI, "gpt-realtime-whisper", REALTIME),
new(OPEN_AI, "gpt-live-1", REALTIME, AnsweredTodayAs: CHAT, Reason: "Found in the chat list while testing. The line which succeeds the realtime models dropped the word, and it is even less of a chat partner: it listens and speaks at once and leaves the thinking to a text model behind it."),
];
/// <summary>
/// The models which work a screen.
/// </summary>
private static readonly ModelKindExample[] COMPUTER_USE_ENTRIES =
[
new(GOOGLE, "gemini-2.5-computer-use-preview-10-2025", COMPUTER_USE, AnsweredTodayAs: CHAT, Reason: "Found in the chat list while testing. Its API refuses every request which does not carry the computer use tool, so a conversation with it cannot even begin."),
];
/// <summary>
@ -161,6 +174,19 @@ public static class ModelKindCorpus
new(SELF_HOSTED, "llama-2-7b-chat-klingon", CHAT),
new(SELF_HOSTED, "llama3.3:70b", CHAT),
new(OPEN_AI, "gpt-5.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
// models with tools already built in, reached through the ordinary chat completion API. And
// Gemini Robotics ER answers in text; it is built for pointing at things in a picture rather
// than for conversation, but a conversation with it works, and a model which works belongs
// in the list.
//
new(X, "grok-build-0.1", CHAT),
new(GROQ, "groq/compound", CHAT),
new(GROQ, "groq/compound-mini", CHAT),
new(GOOGLE, "gemini-robotics-er-1.5-preview", CHAT),
];
/// <summary>
@ -175,6 +201,7 @@ public static class ModelKindCorpus
..TRANSCRIPTION_ENTRIES,
..SPEECH_ENTRIES,
..REALTIME_ENTRIES,
..COMPUTER_USE_ENTRIES,
..TEXT_COMPLETION_ENTRIES,
..OCR_ENTRIES,
..MODERATION_ENTRIES,