Peter Humphrey

About

I never planned to run a company. I planned to fix one annoying problem, and the company sort of grew around it. Ten years later I still think of myself as the person closest to the customer, not the person farthest from the work. Every hire we make, I ask the same question: will this person talk to users without being told to? The part of the job nobody warns you about is how much of it is just holding a steady line. Saying no to good ideas so the great one gets room. Keeping the team calm when a launch slips. I've gotten better at that, slowly, and mostly by getting it wrong first.

Badges

Gone streaking
Gone streaking

Forums

The Answer Was in the Code I Deleted

I spent a day trying to fix something and could not. Nothing worked. I tried everything I could think of.

Then I remembered I had deleted a block of code months ago because I thought it was useless. It was not useless. It was doing something I did not understand, and I had removed it because it was old and messy.

How do you handle callers who code-switch? Do you lock the language, follow the caller, or ask them?

Our callers mix Hindi and English in the same breath: "haan toh mein bol raha tha, why are you calling me?" We assumed language handling was a detection problem. It turned out to be about six separate problems, and we found them one at a time, in production.

1. Detecting a language switch without flip-flopping
A caller says one English word and the bot jumps languages. We settled on a heuristic switch with guardrails you can configure per agent:

  • a minimum number of words per turn (default 3)

  • the same language for consecutive turns (default 2)

  • a dominant-language threshold (0.6) from a fastText classifier

  • a reset of the counter on mismatch, so one stray turn doesn't count

  • "meta" references ignored, for example someone saying "English" while speaking Hindi

2. Callers who just tell you what they want
"Let's speak in English" shouldn't need two confirming turns. We added explicit request detection, in English and Hindi (e.g. " "). It bypasses the heuristics and switches immediately.

View more