feat(llm): make runs resilient and reproducible on slow backends

Retry with exponential backoff and jitter, and honour Retry-After. Retry empty-choice responses and HTTP 408.
Add max_retries, retry_timeouts, model_timeouts and model_concurrency settings for slow local models.
Add opt-in SSE streaming with an idle timeout. A hung server fails early, and a slow but active generation continues.
Send an optional seed and record the backend fingerprint of each answer.
Stamp saved artifacts with run metadata and write them atomically. Warn in compare when two runs differ.
Save partial results on Ctrl-C. Turn an evaluator panic into an error row.
Reject duplicate models and non-http endpoints in the config.
This commit is contained in:
2026-10-02 01:01:14 +01:00
parent 7b791a78e7
commit 1310c5bebe
17 changed files with 1367 additions and 67 deletions
+23
View File
@@ -1,11 +1,15 @@
package main
import (
"context"
"errors"
"fmt"
"strings"
"testing"
"github.com/lukaszraczylo/llm-testbench/internal/eval"
"github.com/lukaszraczylo/llm-testbench/internal/report"
"github.com/lukaszraczylo/llm-testbench/internal/runner"
"github.com/lukaszraczylo/llm-testbench/internal/testkit"
)
@@ -101,3 +105,22 @@ func TestHealthCommand_RequiresArtifacts(t *testing.T) {
t.Errorf("healthCommand(missing file) error = %v, want load error naming the file", err)
}
}
func TestDedupe(t *testing.T) {
got := dedupe([]string{"a", "b", "a", "c", "b"})
if strings.Join(got, ",") != "a,b,c" {
t.Errorf("dedupe = %v, want [a b c]", got)
}
}
func TestDropCancelled(t *testing.T) {
in := []runner.Result{
{TestID: "ok"},
{TestID: "cancelled", Err: fmt.Errorf("wrapped: %w", context.Canceled)},
{TestID: "real-error", Err: errors.New("boom")},
}
got := dropCancelled(in)
if len(got) != 2 || got[0].TestID != "ok" || got[1].TestID != "real-error" {
t.Errorf("dropCancelled = %+v, want ok and real-error kept", got)
}
}