Skip to main content

Turn Detector

The Turn Detector uses a Hugging Face model to determine whether a user's turn is completed or not, enabling precise conversation flow management in cascading pipelines.

Installation​

Install the Turn Detector-enabled VideoSDK Agents package:

pip install "videosdk-plugins-turn-detector"

Importing​

from videosdk.plugins.turn_detector import TurnDetector

Example Usage​

from videosdk.plugins.turn_detector import TurnDetector, pre_download_model
from videosdk.agents import CascadingPipeline

# Pre-download the model (optional but recommended)
pre_download_model()

# Initialize the Turn Detector
turn_detector = TurnDetector(
threshold=0.7
)

# Add Turn Detector to cascading pipeline
pipeline = CascadingPipeline(turn_detector=turn_detector)

Configuration Options​

  • threshold: (float) Confidence threshold for turn completion detection (0.0 to 1.0, default: 0.7)

Pre-downloading Model​

To avoid delays during agent initialization, you can pre-download the Hugging Face model:

from videosdk.plugins.turn_detector import pre_download_model

# Download model before running the agent
pre_download_model()

Got a Question? Ask us on discord