Skip to content

Commit b610dee

Browse files
committed
do not list obvious backends as text backends
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 399bf97 commit b610dee

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

core/config/model_config.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,15 +624,32 @@ func (c *ModelConfig) HasUsecases(u ModelConfigUsecase) bool {
624624
// In its current state, this function should ideally check for properties of the config like templates, rather than the direct backend name checks for the lower half.
625625
// This avoids the maintenance burden of updating this list for each new backend - but unfortunately, that's the best option for some services currently.
626626
func (c *ModelConfig) GuessUsecases(u ModelConfigUsecase) bool {
627+
// Backends that are clearly not text-generation
628+
nonTextGenBackends := []string{
629+
"whisper", "piper", "kokoro",
630+
"diffusers", "stablediffusion", "stablediffusion-ggml",
631+
"rerankers", "silero-vad", "rfdetr",
632+
"transformers-musicgen", "ace-step", "acestep-cpp",
633+
}
634+
627635
if (u & FLAG_CHAT) == FLAG_CHAT {
628636
if c.TemplateConfig.Chat == "" && c.TemplateConfig.ChatMessage == "" && !c.TemplateConfig.UseTokenizerTemplate {
629637
return false
630638
}
639+
if slices.Contains(nonTextGenBackends, c.Backend) {
640+
return false
641+
}
642+
if c.Embeddings != nil && *c.Embeddings {
643+
return false
644+
}
631645
}
632646
if (u & FLAG_COMPLETION) == FLAG_COMPLETION {
633647
if c.TemplateConfig.Completion == "" {
634648
return false
635649
}
650+
if slices.Contains(nonTextGenBackends, c.Backend) {
651+
return false
652+
}
636653
}
637654
if (u & FLAG_EDIT) == FLAG_EDIT {
638655
if c.TemplateConfig.Edit == "" {

0 commit comments

Comments
 (0)