The same text again was answered from what the engine kept of the last reading, in a tenth of the time: the check read 4.9 s, then 0.5 and 0.5. Each judgment now begins with a line of its own. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
85f135311e
commit
6bef138c23
1 file changed
+15
-4
@@ -275,8 +275,20 @@ func (a *API) checkJudge(w http.ResponseWriter, r *http.Request) {
|
||||
v.Burst = 2 * jv.Ready
|
||||
}
|
||||
v.Burst = min(v.Burst, 32)
|
||||
var mu sync.Mutex
|
||||
start := time.Now()
|
||||
// Each text begins differently: the engine keeps what it read before,
|
||||
// and the same text again is answered from that in a tenth of the time
|
||||
// a request's own prompt takes.
|
||||
n := 0
|
||||
text := func() string {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
n++
|
||||
return fmt.Sprintf("Request %d of a check begun at %s.\n", n, start.Format(time.RFC3339Nano)) + judgeCheckText
|
||||
}
|
||||
for range 3 {
|
||||
ans, err := a.guard.Ask(r.Context(), jv.Model, judgeCheckText, "")
|
||||
ans, err := a.guard.Ask(r.Context(), jv.Model, text(), "")
|
||||
if err != nil {
|
||||
writeError(w, http.StatusBadGateway, fmt.Sprintf("the judge %s gave no verdict: %v", jv.Model, err))
|
||||
return
|
||||
@@ -284,14 +296,13 @@ func (a *API) checkJudge(w http.ResponseWriter, r *http.Request) {
|
||||
v.TookMs = append(v.TookMs, ans.Took.Milliseconds())
|
||||
v.SlowestMs = max(v.SlowestMs, ans.Took.Milliseconds())
|
||||
}
|
||||
var mu sync.Mutex
|
||||
var wg sync.WaitGroup
|
||||
start := time.Now()
|
||||
start = time.Now()
|
||||
for range v.Burst {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
ans, err := a.guard.Ask(r.Context(), jv.Model, judgeCheckText, "")
|
||||
ans, err := a.guard.Ask(r.Context(), jv.Model, text(), "")
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user