- ID
- 869b5f8e-eab5-4265-9080-2f620d51fdc3
2026-07-20
Tasks
DONE Fly to Newark
- ID
- 96f46682-0634-cdd6-0bac-2bde2207ac2a
DONE Research hackathon project and get tools setup
- ID
- 14ece565-5220-fc57-b3c8-fd0ddf479279
- Note taken on
New: app/services/customer_segment_namer.py + --label flag on the command.
What it does
Feature vectors → Claude → named personas. Uses:
- claude-opus-4-8 (latest Opus), adaptive thinking, effort: medium.
- Structured outputs (output_config.format json_schema) — Claude must return valid JSON: {name, description, key_traits[], customer_ids[]} per segment. No fragile parsing.
- No hardcoded key — anthropic.Anthropic() reads ANTHROPIC_API_KEY from env (or ant profile).
Run it — the demo money-shot
! ANTHROPIC_API_KEY='<your-key>' QA_DB_PASSWORD='uMCf6X!8@lEI!PLy' \
python manage.py extract_customer_features --qa --sample 30 --label
Output = named segments like "Busy Weeknight Parents" / "Budget Grocery Maximizers" with descriptions + which customers belong. That's the AI 15% — a spreadsheet can't name and describe clusters in plain English.
Prereqs
1. pip install anthropic (not in repo yet — import is lazy so JSON/CSV paths still work without it).
2. ANTHROPIC_API_KEY in env. If unset, ant auth login works too.
Design notes
- Namer import is inside the --label branch — deliberate, so --format csv / json keep working even if anthropic isn't installed. Commented in the code.
- One API call for the whole batch → Claude sees all customers at once, so segments are relatively defined (contrastive), not per-row labels.
The full pipeline your team now has
extract (real QA data) → CSV for clustering ┐
→ --label for AI personas ┘ → demo
DONE Review PRs
- ID
- 06ab9d51-9b94-8da3-bdb6-690b9a7b721e