Skip to content

Commit 6cadff6

Browse files
dpmishlerpcgeek86
andauthored
Add Flux streaming transcription support #131
* feat: add flux support * fix: remove unused import to match websocket.rs pattern * fix: replace json! macro with serde_json::to_string for minimal versions - Replace serde_json::json! macro with ControlMessage enum + serde_json::to_string - Matches websocket.rs pattern for compatibility with minimal dependency versions - Fix clippy warning in text_to_speech_to_stream example * Add 32-bit linear PCM audio encoding format * Add mono audio sample for Flux and update sample application * Add auth module for v1/auth/grant API * Add working Flux example with short-lived auth token * Update version and changelog * Add Cargo.lock file * Fix formatting * Update serde dependency versions * Update dependency versions * Update checkout action to v5 * Add setup Rust toolchain * Remove Cargo.lock * Reduce version of rodio * Allow Cargo.lock --------- Co-authored-by: Trevor Sullivan <trevor.sullivan@deepgram.com>
1 parent d2f2723 commit 6cadff6

File tree

21 files changed

+4328
-23
lines changed

21 files changed

+4328
-23
lines changed

.github/workflows/ci.yaml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ jobs:
1111
Features:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions-rust-lang/setup-rust-toolchain@v1
15+
with:
16+
components: rustfmt
17+
- uses: actions/checkout@v5
1518
- name: Install dependencies
1619
run: |
1720
sudo apt-get update
@@ -28,7 +31,7 @@ jobs:
2831
Build:
2932
runs-on: ubuntu-latest
3033
steps:
31-
- uses: actions/checkout@v3
34+
- uses: actions/checkout@v5
3235
- name: Install dependencies
3336
run: |
3437
sudo apt-get update
@@ -39,7 +42,10 @@ jobs:
3942
Clippy:
4043
runs-on: ubuntu-latest
4144
steps:
42-
- uses: actions/checkout@v3
45+
- uses: actions-rust-lang/setup-rust-toolchain@v1
46+
with:
47+
components: rustfmt
48+
- uses: actions/checkout@v5
4349
- name: Install dependencies
4450
run: |
4551
sudo apt-get update
@@ -50,7 +56,7 @@ jobs:
5056
Test:
5157
runs-on: ubuntu-latest
5258
steps:
53-
- uses: actions/checkout@v3
59+
- uses: actions/checkout@v5
5460
- name: Install dependencies
5561
run: |
5662
sudo apt-get update
@@ -61,13 +67,13 @@ jobs:
6167
Format:
6268
runs-on: ubuntu-latest
6369
steps:
64-
- uses: actions/checkout@v3
70+
- uses: actions/checkout@v5
6571
- name: Cargo Fmt
6672
run: cargo fmt --check --all
6773
Documentation:
6874
runs-on: ubuntu-latest
6975
steps:
70-
- uses: actions/checkout@v3
76+
- uses: actions/checkout@v5
7177
- name: Install dependencies
7278
run: |
7379
sudo apt-get update
@@ -78,7 +84,7 @@ jobs:
7884
Audit:
7985
runs-on: ubuntu-latest
8086
steps:
81-
- uses: actions/checkout@v3
87+
- uses: actions/checkout@v5
8288
- name: Install dependencies
8389
run: sudo apt-get update
8490
- name: Install cargo-audit
@@ -93,7 +99,7 @@ jobs:
9399
Minimal-Versions:
94100
runs-on: ubuntu-latest
95101
steps:
96-
- uses: actions/checkout@v3
102+
- uses: actions/checkout@v5
97103
- name: Install dependencies
98104
run: |
99105
sudo apt-get update
@@ -115,7 +121,7 @@ jobs:
115121
SemVer:
116122
runs-on: ubuntu-latest
117123
steps:
118-
- uses: actions/checkout@v3
124+
- uses: actions/checkout@v5
119125
- name: Install dependencies
120126
run: |
121127
sudo apt-get update

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/target
2-
/Cargo.lock
32
your_output_file.wav
43
.DS_Store

CHANGELOG.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
56
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67

7-
## [Unreleased](https://github.com/deepgram/deepgram-rust-sdk/compare/0.6.2...HEAD)
8+
## [0.8.0](https://github.com/deepgram/deepgram-rust-sdk/compare/0.6.2...HEAD)
89

9-
- Update documentation to point to
10-
[deepgram/deepgram-rust-sdk](https://github.com/deepgram/deepgram-rust-sdk).
10+
- Add Flux conversational speech recognition model support (`flux-general-en`)
11+
- New `flux_request()` and `flux_request_with_options()` methods for Flux streaming
12+
- Support for turn-based conversation detection with `FluxResponse` types
13+
- Configurable end-of-turn detection parameters (`eot_threshold`, `eager_eot_threshold`, `eot_timeout_ms`)
14+
- New `TurnEvent` enum: `StartOfTurn`, `EndOfTurn`, `EagerEndOfTurn`, `TurnResumed`, `Update`
15+
- Examples: `simple_flux` (file streaming) and `microphone_flux` (real-time microphone)
16+
- Uses `/v2/listen` endpoint for Flux API
17+
- Update documentation to point to [deepgram/deepgram-rust-sdk](https://github.com/deepgram/deepgram-rust-sdk).
18+
- Added support for [short-lived auth tokens](https://developers.deepgram.com/reference/auth/tokens/grant) using Deepgram `v1/auth/grant` API
1119

1220
## [0.6.1](https://github.com/deepgram/deepgram-rust-sdk/compare/0.6.1...0.6.2)
1321

14-
-
1522
## [0.6.1](https://github.com/deepgram/deepgram-rust-sdk/compare/0.6.0...0.6.1)
1623

1724
- Implement `From<String>` for `Model`, `Language`, and `Redact`
@@ -98,22 +105,25 @@ Some Enums have changed and may need to be updated
98105
- Add Speech to Text
99106
- Reorganize Code
100107

101-
102108
### Streaming Features
109+
103110
- endpointing
104111
- utterance_end_ms
105112
- interim_results
106113
- no_delay
107114
- vad_events
108115

109116
### Streaming Functions
117+
110118
- keep_alive
111119

112120
### New Streaming Message Types
121+
113122
- Utterance End
114123
- Speech Started
115124

116125
### Pre-Recorded Features
126+
117127
- encoding
118128
- smart_format
119129
- callback
@@ -126,6 +136,7 @@ Some Enums have changed and may need to be updated
126136
- extra
127137

128138
### Pre-Recorded Audio Intelligence Features
139+
129140
- detect_entities
130141
- sentiment
131142
- topics
@@ -147,21 +158,26 @@ Some Enums have changed and may need to be updated
147158
## [0.4.0](https://github.com/deepgram/deepgram-rust-sdk/compare/0.3.0...0.4.0) - 2023-11-01
148159

149160
### Added
161+
150162
- `detect_language` option.
151163

152164
### Changed
165+
153166
- Remove generic from `Deepgram` struct.
154167
- Upgrade dependencies: `tungstenite`, `tokio-tungstenite`, `reqwest`.
155168

156169
## [0.3.0](https://github.com/deepgram/deepgram-rust-sdk/compare/0.2.1...0.3.0) - 2023-07-26
157170

158171
### Added
172+
159173
- Derive `Serialize` for all response types.
160174

161175
### Fixed
176+
162177
- Use the users builder options when building a streaming URL.
163178
- Make sure that `Future` returned from `StreamRequestBuilder::start()` is `Send`.
164179

165180
### Changed
181+
166182
- Use Rustls instead of OpenSSL.
167183

0 commit comments

Comments
 (0)