-
Notifications
You must be signed in to change notification settings - Fork 24
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
SDK Update and Refactor #76
Merged
Merged
Changes from 98 commits
Commits
Show all changes
135 commits
Select commit
Hold shift + click to select a range
5b625ff
Add text to speech
DamienDeepgram 87ccf67
Add text to speech
DamienDeepgram 0ae2ec5
fix build errors
DamienDeepgram 7114c84
fix build errors
DamienDeepgram 49304cd
fix build errors
DamienDeepgram 4cc02af
fix build errors
DamienDeepgram e06c401
fix build errors
DamienDeepgram 4d554c5
remove wav file
DamienDeepgram 6daa8db
Add streaming TTS playback - still has an issue with playback but com…
DamienDeepgram 05f413f
fix the white noise issue
DamienDeepgram f0d43b1
fix build errors
DamienDeepgram f4df430
fix build errors
DamienDeepgram 1164439
fix build errors
DamienDeepgram c314d9b
fix build errors
DamienDeepgram 372ab73
fix build errors
DamienDeepgram 2e6e3c2
fix build errors
DamienDeepgram f7c9d50
fix build errors
DamienDeepgram c7be6ff
fix build errors
DamienDeepgram 9d53691
fix build errors
DamienDeepgram 24f7e6d
fix build errors
DamienDeepgram 0db5703
fix build errors
DamienDeepgram 07e8345
fix build errors
DamienDeepgram 52248f7
fix build errors
DamienDeepgram dd1777d
fix build errors
DamienDeepgram 4440ff0
fix build errors
DamienDeepgram d012d6c
fix build errors
DamienDeepgram 9bab758
fix build errors
DamienDeepgram a27de1f
fix build errors
DamienDeepgram 470e4e2
fix build errors
DamienDeepgram b9d7034
fix build errors
DamienDeepgram e9a7d1c
fix build errors
DamienDeepgram 848533f
fix build errors
DamienDeepgram 017538b
fix build errors
DamienDeepgram 7c4f559
fix build errors
DamienDeepgram 196e46c
fix build errors
DamienDeepgram 4f468e5
fix build errors
DamienDeepgram f32366f
fix build errors
DamienDeepgram 8269b0c
Rrefactor SDK and add Speech to Text and Text to Speech features
DamienDeepgram fe27a1b
fix build error
DamienDeepgram a72c2b2
fix build error
DamienDeepgram 1eb5b02
fix build error
DamienDeepgram 2aa4b77
fix build error
DamienDeepgram 639d56b
fix build error
DamienDeepgram 7065bbd
fix build error
DamienDeepgram acedeab
fix build error
DamienDeepgram 39e7201
fix build error
DamienDeepgram e6063d2
fix build error
DamienDeepgram 843326f
fix build error
DamienDeepgram 7cb90c7
fix build error
DamienDeepgram 9a8d58d
fix build error
DamienDeepgram 28ea919
fix build error
DamienDeepgram eb28f0c
fix build error
DamienDeepgram 2617b35
fix build error
DamienDeepgram b184087
fix build error
DamienDeepgram 3c4d4c5
fix build error
DamienDeepgram ff4baec
fix build error
DamienDeepgram df240ed
fix build error
DamienDeepgram 78bb9dc
fix build error
DamienDeepgram 00f07ca
fix build error
DamienDeepgram e595d08
fix build error
DamienDeepgram 43a0dc6
fix build error
DamienDeepgram ad7f030
fix build error
DamienDeepgram c625ef4
fix build error
DamienDeepgram cdad768
fix build error
DamienDeepgram c7961b7
fix build error
DamienDeepgram dfbbf28
fix build error
DamienDeepgram e125a24
fix build error
DamienDeepgram dd1ec55
fix build error
DamienDeepgram 1c1035d
fix build error
DamienDeepgram d28fd1a
fix build error
DamienDeepgram e3efc6c
fix build error
DamienDeepgram f239f97
Add encoding and endpointing Enums
DamienDeepgram 5535930
Add encoding and endpointing Enums
DamienDeepgram b319e6f
Remove redundant example folders
DamienDeepgram c4140a2
remove test file
DamienDeepgram 9ad966e
fix version
DamienDeepgram 9df7a87
Add test file to gitignore
DamienDeepgram d55c154
update doc link
DamienDeepgram ccd7c8e
update doc link and add keywords
DamienDeepgram e2f199e
Add extra struct
DamienDeepgram ef7cae7
Add struct for callback_method
DamienDeepgram d5b50c9
Add extra struct
DamienDeepgram caf9dbb
Add DetectLanguage enum
DamienDeepgram 425c001
Add keepalive as bool
DamienDeepgram bff63dd
handle booleans correctly
DamienDeepgram 491f05b
fix detect_lanugage and add test
DamienDeepgram 9174458
make Serialize a bool again
DamienDeepgram c573aaa
Remove Extra struct and use hasmap instead
DamienDeepgram 5d61464
fix build errors
DamienDeepgram 8175399
fix build errors
DamienDeepgram 21e0e06
fix build errors
DamienDeepgram 54f5993
fix build errors
DamienDeepgram 0de7c8d
fix build errors
DamienDeepgram 2240fd6
fix build errors
DamienDeepgram ed5503e
make all enums non_exhaustive
DamienDeepgram 3d6d755
move files out of folders to avoid renaming
DamienDeepgram 8817a6a
move files out of folders to avoid renaming
DamienDeepgram 1a0bb25
Update src/common/options.rs
DamienDeepgram 2807ac1
ensure keep alive is sending correctly and keeping the websocket open…
DamienDeepgram 7b6e889
fix build formatting error
DamienDeepgram f81c238
set keepalive back to 10 seconds
DamienDeepgram 92baab6
make error eprintln and remove debug println
DamienDeepgram 410eebe
fix formatting error
DamienDeepgram 46278b5
Add disabled to Endpointing and Detect Language and remove bool param
DamienDeepgram 3e8c12e
remove speech_to_text and text_to_speech modules and move them into t…
DamienDeepgram 7d468ed
rename to CustomDurationMs
DamienDeepgram 038d3d3
update docs
DamienDeepgram ad2242d
Change order of pub and use
DamienDeepgram fadebc1
remove references to text_to_speech and speech_to_text
DamienDeepgram 13ff6c6
fix typo
DamienDeepgram 26ce6cb
remove new line
DamienDeepgram 6d03392
fix build errors
DamienDeepgram e457271
fix build errors
DamienDeepgram d341743
remove old file
DamienDeepgram 7e59a23
Add new options to Utterance for Custom Split
DamienDeepgram 3db0ea5
rename prerecorded to rest and live to websocket
DamienDeepgram 35bd503
remove brackets
DamienDeepgram 6fbd64d
Update Multichannel options for model params
DamienDeepgram 1ccd962
Update Multichannel options for model params
DamienDeepgram 24ce8a8
fix build error
DamienDeepgram 92a6b92
update formatting to fix build error
DamienDeepgram f31ea20
update formatting to fix build error
DamienDeepgram de1f85b
update formatting to fix build error
DamienDeepgram f3de673
add allow missing docs
DamienDeepgram 9788882
remove link based on PR review
DamienDeepgram 48a8801
update changelog
DamienDeepgram 3f20bba
add enums for Speech to Text and add back in links
DamienDeepgram 2527ec2
add enums updated to changelog
DamienDeepgram e9d2b28
fix build errors
DamienDeepgram 9898f5c
fix build errors
DamienDeepgram 314f92c
fix build errors
DamienDeepgram 4b01cb1
fix build errors
DamienDeepgram 2bf7ffb
remove commented out code
DamienDeepgram 48acf39
lowercase EN to En
DamienDeepgram 4bdeb60
lowercase EN to En
DamienDeepgram File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/target | ||
/Cargo.lock | ||
your_output_file.wav |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,86 @@ | ||
[package] | ||
name = "deepgram" | ||
version = "0.5.0" | ||
version = "0.6.0" | ||
authors = ["Deepgram <[email protected]>"] | ||
edition = "2021" | ||
description = "Official Rust SDK for Deepgram's automated speech recognition APIs." | ||
license = "MIT" | ||
repository = "https://github.com/deepgram-devs/deepgram-rust-sdk" | ||
keywords = ["deepgram", "asr", "transcription", "ai", "speech-to-text"] | ||
keywords = ["deepgram", "transcription", "voice ai", "text-to-speech", "tts", "aura", "speech-to-text", "stt", "asr", "nova", "voice agent", "self-hosted"] | ||
categories = ["api-bindings", "multimedia::audio"] | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
# TODO Investigate which of these dependencies can go behind features. | ||
audio = "0.2.0" | ||
bytes = "1" | ||
futures = "0.3" | ||
http = "0.2" | ||
pin-project = "1" | ||
reqwest = { version = "0.11.22", default-features = false, features = ["json", "rustls-tls", "stream"] } | ||
serde = { version = "1", features = ["derive"] } | ||
rodio = { version = "0.17.0", optional = true } | ||
serde = { version = "1.0.25", features = ["derive"] } | ||
serde_json = "1" | ||
serde_urlencoded = "0.7" | ||
thiserror = "1" | ||
tokio = { version = "1.13.0", features = ["full"] } | ||
tokio = { version = "1.38.0", features = ["full"] } | ||
tokio-stream = "0.1.15" | ||
tokio-tungstenite = { version = "0.20.1", features = ["rustls-tls-webpki-roots"], optional = true } | ||
tokio-util = { version = "0.7.1", features = ["codec", "io"] } | ||
tungstenite = { version = "0.20.1", optional = true } | ||
url = "2" | ||
uuid = { version = "1", features = ["serde"] } | ||
# Dependencies below are specified only to satisfy minimal-versions. | ||
proc-macro2 = "1.0.60" | ||
pkg-config = { version = "0.3.30", optional = true } | ||
|
||
[dev-dependencies] | ||
pkg-config = "0.3.27" | ||
cpal = "0.13" | ||
crossbeam = "0.8" | ||
|
||
[features] | ||
default = ["prerecorded", "live"] | ||
live = ["dep:tungstenite", "dep:tokio-tungstenite"] | ||
prerecorded = [] | ||
default = ["manage", "listen", "speak"] | ||
manage = [] | ||
listen = ["dep:tungstenite", "dep:tokio-tungstenite"] | ||
speak = ["dep:rodio", "dep:pkg-config"] | ||
|
||
[[example]] | ||
name = "prerecorded_from_file" | ||
required-features = ["prerecorded"] | ||
path = "examples/transcription/prerecorded/prerecorded_from_file.rs" | ||
required-features = ["listen"] | ||
|
||
[[example]] | ||
name = "callback" | ||
required-features = ["prerecorded"] | ||
path = "examples/transcription/prerecorded/callback.rs" | ||
required-features = ["listen"] | ||
|
||
[[example]] | ||
name = "make_prerecorded_request_builder" | ||
required-features = ["prerecorded"] | ||
path = "examples/transcription/prerecorded/make_prerecorded_request_builder.rs" | ||
required-features = ["listen"] | ||
|
||
[[example]] | ||
name = "prerecorded_from_url" | ||
path = "examples/transcription/prerecorded/prerecorded_from_url.rs" | ||
required-features = ["listen"] | ||
|
||
[[example]] | ||
name = "simple_stream" | ||
path = "examples/transcription/live/simple_stream.rs" | ||
required-features = ["listen"] | ||
|
||
[[example]] | ||
name = "microphone_stream" | ||
required-features = ["live"] | ||
path = "examples/transcription/live/microphone_stream.rs" | ||
required-features = ["listen"] | ||
|
||
[[example]] | ||
name = "prerecorded_from_url" | ||
required-features = ["prerecorded"] | ||
name = "text_to_speech_to_file" | ||
path = "examples/speak/text_to_speech_to_file.rs" | ||
required-features = ["speak"] | ||
|
||
[[example]] | ||
name = "simple_stream" | ||
required-features = ["live"] | ||
name = "text_to_speech_to_stream" | ||
path = "examples/speak/text_to_speech_to_stream.rs" | ||
required-features = ["speak"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## Running Examples | ||
|
||
### Setting Env Vars | ||
|
||
```sh | ||
export FILENAME=./examples/audio/Bueller-Life-moves-pretty-fast.mp3 | ||
``` | ||
|
||
### Running the examples | ||
|
||
```sh | ||
cargo run --example prerecorded_from_url | ||
``` | ||
|
||
```sh | ||
cargo run --example simple_stream | ||
``` | ||
|
||
```sh | ||
cargo run --example advanced_stream | ||
``` |
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use std::{env, path::Path, time::Instant}; | ||
|
||
use deepgram::{speak::options::Options, Deepgram, DeepgramError}; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), DeepgramError> { | ||
let deepgram_api_key = | ||
env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable"); | ||
|
||
let dg_client = Deepgram::new(&deepgram_api_key); | ||
|
||
let options = Options::builder() | ||
.model("aura-asteria-en") | ||
.encoding("linear16") | ||
.sample_rate(16000) | ||
.container("wav") | ||
.build(); | ||
|
||
let text = "Hello, how can I help you today? This is a longer sentence to increase the time taken to process the audio, so that the streaming shows the full delta vs downloading the whole file."; | ||
let output_file = Path::new("your_output_file.wav"); | ||
bd-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Record the start time | ||
let start_time = Instant::now(); | ||
|
||
dg_client | ||
.text_to_speech() | ||
.speak_to_file(text, &options, output_file) | ||
.await?; | ||
|
||
let elapsed_time = start_time.elapsed(); | ||
println!("Time to download audio: {:.2?}", elapsed_time); | ||
|
||
Ok(()) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're doing a major code reorganization, we should probably provide a migration guide that helps users find the new version of code they've been using.
A
CHANGELOG.md
would be a good place to start.