Files
ti/app.py
Henrik Jess Nielsen f374088211 fix(offers): DE→DA translation returned nothing — disable thinking, batch big
Prod showed 0 of 467 headings translated while AI matching worked. Cause:
Haiku 5.5 defaults thinking on, which consumed the 4000-token budget on the
40-item translation batches and truncated the JSON, so every batch fell back
to German. Matching (one small response) slipped through.

- Disable thinking on both Claude calls (mechanical JSON tasks), via a shared
  _claude_json helper that retries without the flag if a model rejects it
- Raise max_tokens (16000 translate / 8000 match) so output fits even if
  thinking stays on
- Batch ~all headings in 1-2 calls (250) instead of 40, so the preamble isn't
  repeated per batch and we don't hammer the rate limit (cheaper, as suggested)
2026-10-30 11:19:40 +01:00

41 KiB