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

SDK Update and Refactor #76

Merged
merged 135 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 125 commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
5b625ff
Add text to speech
DamienDeepgram Jul 13, 2024
87ccf67
Add text to speech
DamienDeepgram Jul 13, 2024
0ae2ec5
fix build errors
DamienDeepgram Jul 13, 2024
7114c84
fix build errors
DamienDeepgram Jul 14, 2024
49304cd
fix build errors
DamienDeepgram Jul 14, 2024
4cc02af
fix build errors
DamienDeepgram Jul 14, 2024
e06c401
fix build errors
DamienDeepgram Jul 14, 2024
4d554c5
remove wav file
DamienDeepgram Jul 14, 2024
6daa8db
Add streaming TTS playback - still has an issue with playback but com…
DamienDeepgram Jul 14, 2024
05f413f
fix the white noise issue
DamienDeepgram Jul 14, 2024
f0d43b1
fix build errors
DamienDeepgram Jul 14, 2024
f4df430
fix build errors
DamienDeepgram Jul 14, 2024
1164439
fix build errors
DamienDeepgram Jul 14, 2024
c314d9b
fix build errors
DamienDeepgram Jul 14, 2024
372ab73
fix build errors
DamienDeepgram Jul 14, 2024
2e6e3c2
fix build errors
DamienDeepgram Jul 14, 2024
f7c9d50
fix build errors
DamienDeepgram Jul 14, 2024
c7be6ff
fix build errors
DamienDeepgram Jul 14, 2024
9d53691
fix build errors
DamienDeepgram Jul 14, 2024
24f7e6d
fix build errors
DamienDeepgram Jul 14, 2024
0db5703
fix build errors
DamienDeepgram Jul 14, 2024
07e8345
fix build errors
DamienDeepgram Jul 14, 2024
52248f7
fix build errors
DamienDeepgram Jul 14, 2024
dd1777d
fix build errors
DamienDeepgram Jul 14, 2024
4440ff0
fix build errors
DamienDeepgram Jul 14, 2024
d012d6c
fix build errors
DamienDeepgram Jul 14, 2024
9bab758
fix build errors
DamienDeepgram Jul 14, 2024
a27de1f
fix build errors
DamienDeepgram Jul 14, 2024
470e4e2
fix build errors
DamienDeepgram Jul 14, 2024
b9d7034
fix build errors
DamienDeepgram Jul 14, 2024
e9a7d1c
fix build errors
DamienDeepgram Jul 14, 2024
848533f
fix build errors
DamienDeepgram Jul 14, 2024
017538b
fix build errors
DamienDeepgram Jul 14, 2024
7c4f559
fix build errors
DamienDeepgram Jul 14, 2024
196e46c
fix build errors
DamienDeepgram Jul 14, 2024
4f468e5
fix build errors
DamienDeepgram Jul 14, 2024
f32366f
fix build errors
DamienDeepgram Jul 14, 2024
8269b0c
Rrefactor SDK and add Speech to Text and Text to Speech features
DamienDeepgram Jul 17, 2024
fe27a1b
fix build error
DamienDeepgram Jul 17, 2024
a72c2b2
fix build error
DamienDeepgram Jul 17, 2024
1eb5b02
fix build error
DamienDeepgram Jul 17, 2024
2aa4b77
fix build error
DamienDeepgram Jul 17, 2024
639d56b
fix build error
DamienDeepgram Jul 17, 2024
7065bbd
fix build error
DamienDeepgram Jul 17, 2024
acedeab
fix build error
DamienDeepgram Jul 17, 2024
39e7201
fix build error
DamienDeepgram Jul 17, 2024
e6063d2
fix build error
DamienDeepgram Jul 17, 2024
843326f
fix build error
DamienDeepgram Jul 17, 2024
7cb90c7
fix build error
DamienDeepgram Jul 17, 2024
9a8d58d
fix build error
DamienDeepgram Jul 17, 2024
28ea919
fix build error
DamienDeepgram Jul 17, 2024
eb28f0c
fix build error
DamienDeepgram Jul 17, 2024
2617b35
fix build error
DamienDeepgram Jul 17, 2024
b184087
fix build error
DamienDeepgram Jul 17, 2024
3c4d4c5
fix build error
DamienDeepgram Jul 17, 2024
ff4baec
fix build error
DamienDeepgram Jul 17, 2024
df240ed
fix build error
DamienDeepgram Jul 17, 2024
78bb9dc
fix build error
DamienDeepgram Jul 17, 2024
00f07ca
fix build error
DamienDeepgram Jul 17, 2024
e595d08
fix build error
DamienDeepgram Jul 17, 2024
43a0dc6
fix build error
DamienDeepgram Jul 17, 2024
ad7f030
fix build error
DamienDeepgram Jul 17, 2024
c625ef4
fix build error
DamienDeepgram Jul 17, 2024
cdad768
fix build error
DamienDeepgram Jul 17, 2024
c7961b7
fix build error
DamienDeepgram Jul 17, 2024
dfbbf28
fix build error
DamienDeepgram Jul 17, 2024
e125a24
fix build error
DamienDeepgram Jul 17, 2024
dd1ec55
fix build error
DamienDeepgram Jul 17, 2024
1c1035d
fix build error
DamienDeepgram Jul 17, 2024
d28fd1a
fix build error
DamienDeepgram Jul 17, 2024
e3efc6c
fix build error
DamienDeepgram Jul 17, 2024
f239f97
Add encoding and endpointing Enums
DamienDeepgram Jul 17, 2024
5535930
Add encoding and endpointing Enums
DamienDeepgram Jul 17, 2024
b319e6f
Remove redundant example folders
DamienDeepgram Jul 17, 2024
c4140a2
remove test file
DamienDeepgram Jul 17, 2024
9ad966e
fix version
DamienDeepgram Jul 17, 2024
9df7a87
Add test file to gitignore
DamienDeepgram Jul 17, 2024
d55c154
update doc link
DamienDeepgram Jul 17, 2024
ccd7c8e
update doc link and add keywords
DamienDeepgram Jul 17, 2024
e2f199e
Add extra struct
DamienDeepgram Jul 17, 2024
ef7cae7
Add struct for callback_method
DamienDeepgram Jul 17, 2024
d5b50c9
Add extra struct
DamienDeepgram Jul 17, 2024
caf9dbb
Add DetectLanguage enum
DamienDeepgram Jul 17, 2024
425c001
Add keepalive as bool
DamienDeepgram Jul 17, 2024
bff63dd
handle booleans correctly
DamienDeepgram Jul 17, 2024
491f05b
fix detect_lanugage and add test
DamienDeepgram Jul 17, 2024
9174458
make Serialize a bool again
DamienDeepgram Jul 17, 2024
c573aaa
Remove Extra struct and use hasmap instead
DamienDeepgram Jul 17, 2024
5d61464
fix build errors
DamienDeepgram Jul 17, 2024
8175399
fix build errors
DamienDeepgram Jul 17, 2024
21e0e06
fix build errors
DamienDeepgram Jul 17, 2024
54f5993
fix build errors
DamienDeepgram Jul 17, 2024
0de7c8d
fix build errors
DamienDeepgram Jul 17, 2024
2240fd6
fix build errors
DamienDeepgram Jul 17, 2024
ed5503e
make all enums non_exhaustive
DamienDeepgram Jul 17, 2024
3d6d755
move files out of folders to avoid renaming
DamienDeepgram Jul 18, 2024
8817a6a
move files out of folders to avoid renaming
DamienDeepgram Jul 18, 2024
1a0bb25
Update src/common/options.rs
DamienDeepgram Jul 19, 2024
2807ac1
ensure keep alive is sending correctly and keeping the websocket open…
DamienDeepgram Jul 19, 2024
7b6e889
fix build formatting error
DamienDeepgram Jul 19, 2024
f81c238
set keepalive back to 10 seconds
DamienDeepgram Jul 19, 2024
92baab6
make error eprintln and remove debug println
DamienDeepgram Jul 19, 2024
410eebe
fix formatting error
DamienDeepgram Jul 19, 2024
46278b5
Add disabled to Endpointing and Detect Language and remove bool param
DamienDeepgram Jul 22, 2024
3e8c12e
remove speech_to_text and text_to_speech modules and move them into t…
DamienDeepgram Jul 23, 2024
7d468ed
rename to CustomDurationMs
DamienDeepgram Jul 23, 2024
038d3d3
update docs
DamienDeepgram Jul 23, 2024
ad2242d
Change order of pub and use
DamienDeepgram Jul 23, 2024
fadebc1
remove references to text_to_speech and speech_to_text
DamienDeepgram Jul 23, 2024
13ff6c6
fix typo
DamienDeepgram Jul 23, 2024
26ce6cb
remove new line
DamienDeepgram Jul 23, 2024
6d03392
fix build errors
DamienDeepgram Jul 23, 2024
e457271
fix build errors
DamienDeepgram Jul 23, 2024
d341743
remove old file
DamienDeepgram Jul 23, 2024
7e59a23
Add new options to Utterance for Custom Split
DamienDeepgram Jul 23, 2024
3db0ea5
rename prerecorded to rest and live to websocket
DamienDeepgram Jul 23, 2024
35bd503
remove brackets
DamienDeepgram Jul 23, 2024
6fbd64d
Update Multichannel options for model params
DamienDeepgram Jul 23, 2024
1ccd962
Update Multichannel options for model params
DamienDeepgram Jul 23, 2024
24ce8a8
fix build error
DamienDeepgram Jul 23, 2024
92a6b92
update formatting to fix build error
DamienDeepgram Jul 23, 2024
f31ea20
update formatting to fix build error
DamienDeepgram Jul 23, 2024
de1f85b
update formatting to fix build error
DamienDeepgram Jul 23, 2024
f3de673
add allow missing docs
DamienDeepgram Jul 23, 2024
9788882
remove link based on PR review
DamienDeepgram Jul 23, 2024
48a8801
update changelog
DamienDeepgram Jul 23, 2024
3f20bba
add enums for Speech to Text and add back in links
DamienDeepgram Jul 23, 2024
2527ec2
add enums updated to changelog
DamienDeepgram Jul 23, 2024
e9d2b28
fix build errors
DamienDeepgram Jul 23, 2024
9898f5c
fix build errors
DamienDeepgram Jul 23, 2024
314f92c
fix build errors
DamienDeepgram Jul 23, 2024
4b01cb1
fix build errors
DamienDeepgram Jul 23, 2024
2bf7ffb
remove commented out code
DamienDeepgram Jul 23, 2024
48acf39
lowercase EN to En
DamienDeepgram Jul 24, 2024
4bdeb60
lowercase EN to En
DamienDeepgram Jul 24, 2024
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
48 changes: 34 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,57 @@ env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
PKG_CONFIG_PATH: /usr/lib/pkgconfig

jobs:
Features:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install libasound2-dev
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libasound2-dev
sudo apt-get install -y alsa pkg-config libasound2-dev
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
- name: Check no features
run: cargo check --all-targets --no-default-features
- name: Check prerecorded feature
run: cargo check --all-targets --no-default-features --features=prerecorded
- name: Check live feature
run: cargo check --all-targets --no-default-features --features=live
- name: Check listen feature
run: cargo check --all-targets --no-default-features --features=listen
- name: Check speak feature
run: cargo check --all-targets --no-default-features --features=speak
- name: Check manage feature
run: cargo check --all-targets --no-default-features --features=manage
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install libasound2-dev
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libasound2-dev
sudo apt-get install -y alsa pkg-config libasound2-dev
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
- name: Cargo Build
run: cargo build --all-targets --all-features
Clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install libasound2-dev
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libasound2-dev
sudo apt-get install -y alsa pkg-config libasound2-dev
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
- name: Cargo Clippy
run: cargo clippy --all-targets --all-features
Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install libasound2-dev
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libasound2-dev
sudo apt-get install -y alsa pkg-config libasound2-dev
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
- name: Cargo Test
run: cargo test --all --all-features
Format:
Expand All @@ -61,12 +68,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y alsa pkg-config libasound2-dev
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
- name: Cargo Doc
run: cargo doc --workspace --all-features
Audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get update
- name: Install cargo-audit
run: cargo install --locked cargo-audit
- name: Remove Dev Dependencies
Expand All @@ -80,10 +94,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install libasound2-dev
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libasound2-dev
sudo apt-get install -y alsa pkg-config libasound2-dev
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
- name: Install Rust Nightly
run: rustup toolchain install nightly
- name: Cargo Build
Expand All @@ -101,6 +116,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y alsa pkg-config libasound2-dev
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
- name: Install cargo-semver-checks
run: cargo install --locked cargo-semver-checks
- name: Cargo SemVer Checks
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
/Cargo.lock
your_output_file.wav
84 changes: 84 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,90 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.6.0] - 2024-07-23

### Migrating from 0.4.0 -> 0.6.0

Module Imports

```
use deepgram::{
--- transcription::prerecorded::{
+++ common::{
audio_source::AudioSource,
options::{Language, Options},
},
Deepgram, DeepgramError,
};
```

DamienDeepgram marked this conversation as resolved.
Show resolved Hide resolved
Streaming Changes

Now you can pass Options using stream_request_with_options
```
let options = Options::builder()
.smart_format(true)
.language(Language::en_US)
.build();

let mut results = dg
.transcription()
.stream_request_with_options(Some(&options))
.file(PATH_TO_FILE, AUDIO_CHUNK_SIZE, Duration::from_millis(16))
.await?
.start()
.await?;
```

### Changed

- Add streaming features
- Add support for pre-recorded features when streaming
- Add Speech to Text
- Refactor Code
DamienDeepgram marked this conversation as resolved.
Show resolved Hide resolved

Note that this modifies some public enum's which are used internally but might need to be taken into account
- Bumped the minor version but it might need a major bump?
- Maybe a 1.0.0 release?
DamienDeepgram marked this conversation as resolved.
Show resolved Hide resolved

### Streaming Features
- endpointing
- utterance_end_ms
- interim_results
- no_delay
- vad_events

### Streaming Functions
- keep_alive

### New Streaming Message Types
- Utterance End
- Speech Started

### Pre-Recorded Features
- encoding
- smart_format
- callback
- callback_method
- filler_words
- paragraphs
- diarize_version
- dictation
- measurements
- extra

### Pre-Recorded Audio Intelligence Features
- detect_entities
- sentiment
- topics
- summarize
- intents
- custom_intents
- custom_intent_mode
- topics
- custom_topics
- custom_topic_mode

## [Unreleased]
DamienDeepgram marked this conversation as resolved.
Show resolved Hide resolved
- Deprecate tiers and add explicit support for all currently available models.
DamienDeepgram marked this conversation as resolved.
Show resolved Hide resolved
- Expand language enum to include all currently-supported languages.
Expand Down
53 changes: 37 additions & 16 deletions Cargo.toml
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/rest/prerecorded_from_file.rs"
required-features = ["listen"]

[[example]]
name = "callback"
required-features = ["prerecorded"]
path = "examples/transcription/rest/callback.rs"
required-features = ["listen"]

[[example]]
name = "make_prerecorded_request_builder"
required-features = ["prerecorded"]
path = "examples/transcription/rest/make_prerecorded_request_builder.rs"
required-features = ["listen"]

[[example]]
name = "prerecorded_from_url"
path = "examples/transcription/rest/prerecorded_from_url.rs"
required-features = ["listen"]

[[example]]
name = "simple_stream"
path = "examples/transcription/websocket/simple_stream.rs"
required-features = ["listen"]

[[example]]
name = "microphone_stream"
required-features = ["live"]
path = "examples/transcription/websocket/microphone_stream.rs"
required-features = ["listen"]

[[example]]
name = "prerecorded_from_url"
required-features = ["prerecorded"]
name = "text_to_speech_to_file"
path = "examples/speak/rest/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/rest/text_to_speech_to_stream.rs"
required-features = ["speak"]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ To make sure our community is safe for all, be sure to review and agree to our
[Code of Conduct](./CODE_OF_CONDUCT.md). Then see the
[Contributing Guidelines](./CONTRIBUTING.md) for more information.

### Build the SDK

```sh
cargo build
```

Copy link
Contributor

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.

## Getting Help

We love to hear from you so if you have questions, comments or find a bug in the
Expand Down
21 changes: 21 additions & 0 deletions examples/README.md
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 added examples/audio/bueller.wav
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.
36 changes: 0 additions & 36 deletions examples/prerecorded_from_url.rs

This file was deleted.

Loading
Loading