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

from signalwire import AgentBase
from signalwire import FunctionResult
agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")
@agent.tool(name="configure_timeouts", description="Configure speech recognition timeouts")
def configure_timeouts(args, raw_data):
return (
FunctionResult()
.set_end_of_speech_timeout(800)
.set_speech_event_timeout(5000)
)
agent.serve()