Keep non-chat models out of the chat lists

This commit is contained in:
Thorsten Sommer committed 2026-09-12 13:52:10 +02:00
1 parent 77130a450a
commit b6defc8b4b
11 files changed
+111 -5

No files matched your search

@@ -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)
]
};
@@ -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>
@@ -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())]
};
}