Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ members = [
]

[workspace.package]
version = "3.3.2"
version = "3.4.0"
edition = "2024"
license = "MIT"
repository = "https://github.com/pragmatrix/context-switch"
Expand Down
10 changes: 10 additions & 0 deletions examples/transcribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ struct Args {
#[arg(long)]
diarization: bool,
#[arg(long)]
numerals: bool,
#[arg(long)]
turn_threshold: Option<f64>,
#[arg(long, value_enum)]
turn_threshold_level: Option<TurnThresholdLevel>,
Expand Down Expand Up @@ -87,6 +89,7 @@ struct ProviderArgs<'a> {
transcription_model: Option<&'a str>,
region: Option<&'a str>,
diarization: bool,
numerals: bool,
turn_detection: Option<TurnDetection>,
}

Expand All @@ -107,6 +110,7 @@ async fn main() -> Result<()> {
transcription_model: args.transcription_model.as_deref(),
region: args.region.as_deref(),
diarization: args.diarization,
numerals: args.numerals,
turn_detection: if args.turn_threshold.is_some()
|| args.turn_threshold_level.is_some()
|| args.turn_timeout_ms.is_some()
Expand Down Expand Up @@ -268,6 +272,7 @@ async fn start_conversation(
provider_args.transcription_model,
provider_args.region,
provider_args.diarization,
provider_args.numerals,
provider_args.turn_detection.is_some(),
)?;

Expand Down Expand Up @@ -405,6 +410,7 @@ async fn start_conversation(
endpoint: env::var("DEEPGRAM_ENDPOINT").expect("DEEPGRAM_ENDPOINT undefined"),
language: languages.join_csv(),
profanity_filter: false,
numerals: provider_args.numerals,
keyterm: vec![],
turn_detection: provider_args.turn_detection.clone(),
};
Expand All @@ -418,6 +424,7 @@ async fn start_conversation(
struct ProviderCapabilities {
region: bool,
diarization: bool,
numerals: bool,
model: bool,
transcription_model: bool,
turn_detection: bool,
Expand All @@ -433,6 +440,7 @@ impl Provider {
capabilities.model = true;
}
Provider::Deepgram => {
capabilities.numerals = true;
capabilities.turn_detection = true;
}
Provider::Elevenlabs => {
Expand Down Expand Up @@ -482,6 +490,7 @@ fn validate_provider_args(
transcription_model: Option<&str>,
region: Option<&str>,
diarization: bool,
numerals: bool,
turn_detection: bool,
) -> Result<()> {
let capabilities = provider.capabilities();
Expand All @@ -500,6 +509,7 @@ fn validate_provider_args(
capabilities.diarization,
provider,
)?;
validate_capability("--numerals", numerals, capabilities.numerals, provider)?;
validate_capability(
"--turn-threshold/--turn-threshold-level/--turn-timeout-ms/--turn-eager-threshold",
turn_detection,
Expand Down
6 changes: 6 additions & 0 deletions services/deepgram/src/transcribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ pub struct Params {
/// Replace detected profanity with asterisks in the transcript.
#[serde(default)]
pub profanity_filter: bool,
/// Format recognized numbers as numerals in the transcript.
#[serde(default)]
pub numerals: bool,
/// Key terms to boost recognition accuracy for domain-specific vocabulary.
#[serde(default)]
pub keyterm: Vec<String>,
Expand Down Expand Up @@ -79,6 +82,9 @@ impl Service for DeepgramTranscribe {
if params.profanity_filter {
options_builder = options_builder.profanity_filter(true);
}
if params.numerals {
options_builder = options_builder.numerals(true);
}

let options_builder = if let Some(language_hints) = language_hints {
options_builder.language_hint(language_hints)
Expand Down
Loading