test(config): chat defaults for uploads come from measurement, not a guess (red)
iguana/gemma4-26b answered correctly at 90,000 chars but SILENTLY dropped the head of a 120,000-char transcript (prompt tokens fell to 16k; 'not in the text'); koala/phi4-mini has an 8,192-token context and answers HTTP 400 at ~13k tokens. So the budget is 90,000 and the upload chat model defaults to gemma4-26b. Red: UploadChatModel is undefined. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,7 @@ func clearUploadEnv(t *testing.T) {
|
|||||||
"TAPIR_UPLOADS_ENABLED", "TAPIR_UPLOAD_MAX_MB", "TAPIR_UPLOAD_MAX_MINUTES",
|
"TAPIR_UPLOADS_ENABLED", "TAPIR_UPLOAD_MAX_MB", "TAPIR_UPLOAD_MAX_MINUTES",
|
||||||
"TAPIR_TRANSCRIBE_MODEL", "TAPIR_TRANSCRIBE_FALLBACK_MODEL", "TAPIR_TRANSCRIBE_TIMEOUT",
|
"TAPIR_TRANSCRIBE_MODEL", "TAPIR_TRANSCRIBE_FALLBACK_MODEL", "TAPIR_TRANSCRIBE_TIMEOUT",
|
||||||
"TAPIR_UPLOAD_TMP_DIR", "TAPIR_FFMPEG_BIN", "TAPIR_FFPROBE_BIN",
|
"TAPIR_UPLOAD_TMP_DIR", "TAPIR_FFMPEG_BIN", "TAPIR_FFPROBE_BIN",
|
||||||
"TAPIR_MAX_UPLOADED_TRANSCRIPT_CHARS",
|
"TAPIR_MAX_UPLOADED_TRANSCRIPT_CHARS", "TAPIR_UPLOAD_CHAT_MODEL",
|
||||||
} {
|
} {
|
||||||
unset(t, k)
|
unset(t, k)
|
||||||
}
|
}
|
||||||
@@ -52,8 +52,26 @@ func TestLoad_UploadDefaults(t *testing.T) {
|
|||||||
if c.FFmpegBin != "ffmpeg" || c.FFprobeBin != "ffprobe" {
|
if c.FFmpegBin != "ffmpeg" || c.FFprobeBin != "ffprobe" {
|
||||||
t.Errorf("bins = %q, %q", c.FFmpegBin, c.FFprobeBin)
|
t.Errorf("bins = %q, %q", c.FFmpegBin, c.FFprobeBin)
|
||||||
}
|
}
|
||||||
if c.MaxUploadedTranscriptChars != 120000 {
|
if c.MaxUploadedTranscriptChars != 90000 {
|
||||||
t.Errorf("MaxUploadedTranscriptChars = %d, want 120000", c.MaxUploadedTranscriptChars)
|
t.Errorf("MaxUploadedTranscriptChars = %d, want 90000: iguana/gemma4-26b answered correctly at 90,000 chars "+
|
||||||
|
"but silently dropped the head of a 120,000-char transcript (docs/research/chat-context)", c.MaxUploadedTranscriptChars)
|
||||||
|
}
|
||||||
|
if c.UploadChatModel != "iguana/gemma4-26b" {
|
||||||
|
t.Errorf("UploadChatModel = %q: koala/phi4-mini has an 8,192-token context and answers HTTP 400 on an hour of speech", c.UploadChatModel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLoad_UploadChatModelOverride(t *testing.T) {
|
||||||
|
clearUploadEnv(t)
|
||||||
|
t.Setenv("TAPIR_UPLOAD_CHAT_MODEL", "koala/qwen36-35b-a3b")
|
||||||
|
|
||||||
|
c, err := Load()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Load: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.UploadChatModel != "koala/qwen36-35b-a3b" {
|
||||||
|
t.Errorf("UploadChatModel = %q", c.UploadChatModel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user