PLAYBOOK SUMMARY
Keep it simple and consistent:
Keys: clear, user-shaped:
what is X, how does X work, what materials are used in X, can X be used for Y, benefits of X, etc.
First 200 chars of the answer: include the must-have tokens the user is likely to type. That’s what our content signal reads first.
Avoid duplicate keys; when two topics are close, make the keys explicitly distinct (e.g., add the disambiguator word).
If a crucial term only appears in the answer (like neodymium), put it early once—our prescan/nudge now catches it reliably.
What each knob does
kw (key weight): how much to trust the question-to-key match. Bigger kw = key dominates.
cw (content weight): how much to trust the first ~200 chars of the answer. Bigger cw = preview content can move results more.
kg (gate): if the key match is below this number, content is ignored. (Prevents weak keys from being dragged by content.)
floor (content floor): if content score is below this number, treat content as 0. (Filters noisy previews.)
cap (content cap): even when content helps, final score can’t exceed key + cap. (Stops runaway boosts.)
“key=100?”
That’s just the display scale in debug (0–100). For short-circuited near-exact matches we still keep the raw 990/1000 internally and also show key_raw=990 in the debug line you added. So:
Labs usage crystal clear (tiny tweak)
Flip Labs form with “Send overrides (tuning)” checkbox. When it’s unchecked, the script doesn’t include kw/cw/kg/cap/floor in the JSON—so you’re guaranteed to mirror production. When it’s checked, it includes them—so you’re in tuning mode.
CONSOLE TEST
fetch(“https://ak1amc.pythonanywhere.com/debug_match”,{
method:”POST”,
headers:{‘Content-Type’:’application/json’},
body:JSON.stringify({
question:”neodymium“,
topic:”general“,
kw:0.60, cw:0.40, kg:20, cap:20, floor:35
})
}).then(r=>r.json()).then(console.log)