Do not name a judge model in the error a client gets for a model nobody serves

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-04 15:37:52 +02:00
1 parent dbcecd1e85
commit bd4736125b
2 files changed
+15 -1

No files matched your search

+14
View File
@@ -241,3 +241,17 @@ func TestWhatTheGuardrailsDidIsCounted(t *testing.T) {
t.Errorf("output blocks counted %v", n)
}
}
func TestAJudgeModelIsNotNamedToClientsInErrors(t *testing.T) {
e := newFakeEngine(t, "llama-guard")
cfg := baseConfig(config.Endpoint{ID: "j", URL: e.srv.URL, Models: []string{"llama-guard"}})
judge := catModel("llama-guard", nil)
judge.Role, judge.Guard = catalog.RoleGuard, &catalog.GuardModel{Format: "llamaguard3"}
cfg.Models = []catalog.Model{judge, catModel("absent", nil)}
rt := newTestRouter(t, cfg)
waitForEndpoint(t, rt)
rec := post(t, rt.Handler(), map[string]any{"model": "absent", "messages": []any{}}, nil)
if strings.Contains(rec.Body.String(), "llama-guard") {
t.Errorf("named: %s", rec.Body.String())
}
}
+1 -1
View File
@@ -817,7 +817,7 @@ func (r *Router) dispatchOne(ctx context.Context, w http.ResponseWriter, req *pa
return dispatchResult{err: fmt.Errorf("%w: %s", errLoading,
"the model is loading; retry shortly")}
}
return dispatchResult{err: fmt.Errorf("%w: %s", errNoCapacity, noEndpointFor(model, r.servedModels()))}
return dispatchResult{err: fmt.Errorf("%w: %s", errNoCapacity, noEndpointFor(model, slices.DeleteFunc(r.servedModels(), r.isGuardModel)))}
}
profile := r.profileFor(entry, req.ProfileOverride)