Ethan Tan
05/20/2025, 11:12 PMwaitFunction: "(x <= 0.5 ? 100 : (x <= 0.8 ? 200 : 300))"
But all of a sudden it started returning:
"startSpeakingPlan.smartEndpointingPlan.waitFunction:
The expression 'f(x) = (x <= 0.8 ? 100 : (x <= 0.5 ? 100 : (x <= 0.8 ? 200 : 300))' has invalid syntax.
Math.js error: Invalid left hand side of assignment operator (char 4)"
],
"error": "Bad Request",
"statusCode": 400
}
Seems like something was changed on Vapi's side (something to do with f(x) maybe)
What was changed please and can we please get it fixed asap! It was working wellVapi Support Bot
05/20/2025, 11:13 PMwaitFunction
parameter now only supports direct mathematical expressions and not ternary (? :
) or assignment (=
) syntax. To resolve the error, use a formula like:
waitFunction: "200 + 8000 * x"
This will map x
(probability) to a wait time in milliseconds. For more complex logic, you may need to approximate with a continuous function instead of conditional logic.
[See documentation for details.](https://docs.vapi.ai/customization/speech-configuration)
Sources:
- [Speech configuration documentation](https://docs.vapi.ai/customization/speech-configuration)
- [Changelog May 7, 2025](https://docs.vapi.ai/changelog/2025/5/7)Kyle
05/21/2025, 8:01 AM