Default to Sonnet 5.5 and make the Claude model an admin setting

Every Claude call used a hard-coded claude-haiku-4-5. The model is now
CLAUDE_MODEL, read by the Python service, defaulting to
claude-sonnet-5-5 and offered on the admin panel's Environment tab as a
choice of Haiku 4.5, Sonnet 5.5 and Opus 5.5.

The request is shaped per model. Sonnet and Opus think by default and
bill that against max_tokens, so they get low effort and 4,000 tokens of
headroom over each caller's reply ceiling; Haiku 4.5 rejects the effort
setting and keeps the plain request. A refusal is logged and reported as
the route's failed message instead of surfacing as an empty reply.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-12 15:52:33 +01:00
co-authored by Claude Opus 5.5
parent 299b5f5224
commit 3764ea9c0b
9 changed files with 136 additions and 14 deletions
+4 -2
View File
@@ -16,7 +16,7 @@ import httpx2 as httpx
import pytest
from fastapi.testclient import TestClient
from app import email_classify, main
from app import claude, email_classify, main
ROUTE = "/internal/email/classify"
MESSAGE = (
@@ -90,7 +90,9 @@ def test_classify_sends_the_email_unchanged_as_the_user_turn(fake_claude):
assert analysis.model_dump() == ANALYSIS
(call,) = fake_claude.calls
assert call["model"] == email_classify.MODEL
assert call["max_tokens"] == 512
# 512 is the reply's ceiling; what is sent adds room for thinking on a
# model that thinks (claude._model_options).
assert call["max_tokens"] == claude._model_options(claude.MODEL, 512)["max_tokens"]
# The instructions travel in the system prompt and the email in the user
# turn, exactly as Go formatted it.
assert call["system"] == email_classify.SYSTEM