set_speech_event_timeout

View as MarkdownOpen in Claude

Adjust the speech event timeout. This controls how many milliseconds since the last speech detection event to wait before finalizing recognition. This timeout works better than set_end_of_speech_timeout() in noisy environments.

Parameters

milliseconds
intRequired

Timeout in milliseconds.

Returns

FunctionResult — self, for chaining.

Example

1from signalwire import AgentBase
2from signalwire import FunctionResult
3
4agent = AgentBase(name="my-agent", route="/agent")
5agent.set_prompt_text("You are a helpful assistant.")
6
7@agent.tool(name="configure_timeouts", description="Configure speech recognition timeouts")
8def configure_timeouts(args, raw_data):
9 return (
10 FunctionResult()
11 .set_end_of_speech_timeout(800)
12 .set_speech_event_timeout(5000)
13 )
14
15agent.serve()