Skip to content

Adding properties for Utterance End #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions vocode/streaming/models/transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class TranscriberConfig(TypedModel, type=TranscriberType.BASE.value):
input_device_config: Optional[InputDeviceConfig] = None
vad: bool = False
experimental: bool = False
utterance_end_ms: int = None
deepgram_endpoint_ms: int = None

@validator("min_interrupt_confidence")
def min_interrupt_confidence_must_be_between_0_and_1(cls, v):
Expand All @@ -78,6 +80,8 @@ def from_input_device_config_experimental(
endpointing_config: Optional[EndpointingConfig] = None,
vad: Optional[bool] = False,
experimental: Optional[bool] = False,
utterance_end_ms: Optional[float] = None,
deepgram_endpoint_ms: Optional[float] = None,
**kwargs,
):
return cls(
Expand All @@ -87,6 +91,8 @@ def from_input_device_config_experimental(
endpointing_config=endpointing_config,
vad=vad,
experimental=experimental,
utterance_end_ms=utterance_end_ms,
deepgram_endpoint_ms=deepgram_endpoint_ms,
input_device_config=InputDeviceConfig(
sampling_rate=input_device.sampling_rate,
audio_encoding=input_device.audio_encoding
Expand All @@ -99,6 +105,8 @@ def from_input_device_config_vad(
cls,
input_device: BaseInputDevice,
endpointing_config: Optional[EndpointingConfig] = None,
utterance_end_ms: Optional[float] = None,
deepgram_endpoint_ms: Optional[float] = None,
**kwargs,
):
return cls(
Expand All @@ -107,6 +115,8 @@ def from_input_device_config_vad(
chunk_size=input_device.chunk_size,
endpointing_config=endpointing_config,
vad=True,
utterance_end_ms=utterance_end_ms,
deepgram_endpoint_ms=deepgram_endpoint_ms,
# this is used for mapping the input device to the transcriber
input_device_config=InputDeviceConfig(
sampling_rate=input_device.sampling_rate,
Expand All @@ -120,13 +130,17 @@ def from_input_device(
cls,
input_device: BaseInputDevice,
endpointing_config: Optional[EndpointingConfig] = None,
utterance_end_ms: Optional[float] = None,
deepgram_endpoint_ms: Optional[float] = None,
**kwargs,
):
return cls(
sampling_rate=input_device.sampling_rate,
audio_encoding=input_device.audio_encoding,
chunk_size=input_device.chunk_size,
endpointing_config=endpointing_config,
utterance_end_ms=utterance_end_ms,
deepgram_endpoint_ms=deepgram_endpoint_ms,
**kwargs,
)

Expand Down