Skip to content
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

Featurize transcription modes #68

Merged
merged 8 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
- Deprecate tiers and add explicit support for all currently available models.
- Expand language enum to include all currently-supported languages.
- Add (default on) feature flags for live and prerecorded transcription.

## [0.4.0] - 2023-11-01

Expand Down
9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "1"
tokio = { version = "1.13.0", features = ["full"] }
tokio-tungstenite = { version = "0.20.1", features = ["rustls-tls-webpki-roots"] }
tokio-tungstenite = { version = "0.20.1", features = ["rustls-tls-webpki-roots"], optional = true }
tokio-util = { version = "0.7.1", features = ["codec", "io"] }
tungstenite = "0.20.1"
tungstenite = { version = "0.20.1", optional = true }
url = "2"
uuid = { version = "1", features = ["serde"] }
# Dependencies below are specified only to satisfy minimal-versions.
Expand All @@ -34,3 +34,8 @@ proc-macro2 = "1.0.60"
pkg-config = "0.3.27"
cpal = "0.13"
crossbeam = "0.8"

[features]
default = ["prerecorded", "live"]
live = ["dep:tungstenite", "dep:tokio-tungstenite"]
andrewhalle marked this conversation as resolved.
Show resolved Hide resolved
prerecorded = []
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ mod response;
/// Make transcriptions requests using [`Deepgram::transcription`].
#[derive(Debug, Clone)]
pub struct Deepgram {
#[cfg_attr(not(feature = "live"), allow(unused))]
api_key: String,
client: reqwest::Client,
}
Expand Down Expand Up @@ -65,6 +66,7 @@ pub enum DeepgramError {
#[error("Something went wrong during I/O: {0}")]
IoError(#[from] io::Error),

#[cfg(feature = "live")]
/// Something went wrong with WS.
#[error("Something went wrong with WS: {0}")]
WsError(#[from] tungstenite::Error),
Expand Down
2 changes: 2 additions & 0 deletions src/transcription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

use crate::Deepgram;

#[cfg(feature = "live")]
pub mod live;
#[cfg(feature = "prerecorded")]
pub mod prerecorded;

/// Transcribe audio using Deepgram's automated speech recognition.
Expand Down
Loading