Skip to content

Commit

Permalink
Add new options to Utterance for Custom Split
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienDeepgram committed Jul 23, 2024
1 parent d341743 commit 7e59a23
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 7 deletions.
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,
};
```

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

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?

### 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]
- Deprecate tiers and add explicit support for all currently available models.
- Expand language enum to include all currently-supported languages.
Expand Down
19 changes: 12 additions & 7 deletions src/common/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,13 +603,17 @@ pub struct Keyword {
#[non_exhaustive]
pub enum Utterances {
#[allow(missing_docs)]
Enabled {
#[allow(missing_docs)]
utt_split: Option<f64>,
},
Enabled,

#[allow(missing_docs)]
Disabled,


#[allow(missing_docs)]
CustomSplit {
#[allow(missing_docs)]
utt_split: Option<f64>,
},
}

/// Used as a parameter for [`OptionsBuilder::multichannel`].
Expand Down Expand Up @@ -1385,7 +1389,7 @@ impl OptionsBuilder {
/// ```
pub fn utterances(mut self, utterances: bool) -> Self {
self.0.utterances = Some(if utterances {
Utterances::Enabled { utt_split: None }
Utterances::Enabled
} else {
Utterances::Disabled
});
Expand Down Expand Up @@ -1413,7 +1417,7 @@ impl OptionsBuilder {
/// .build();
/// ```
pub fn utterances_with_utt_split(mut self, utt_split: f64) -> Self {
self.0.utterances = Some(Utterances::Enabled {
self.0.utterances = Some(Utterances::CustomSplit {
utt_split: Some(utt_split),
});
self
Expand Down Expand Up @@ -2061,7 +2065,8 @@ impl Serialize for SerializableOptions<'_> {

match utterances {
Some(Utterances::Disabled) => seq.serialize_element(&("utterances", false))?,
Some(Utterances::Enabled { utt_split }) => {
Some(Utterances::Enabled) => seq.serialize_element(&("utterances", true))?,
Some(Utterances::CustomSplit { utt_split }) => {
seq.serialize_element(&("utterances", true))?;

if let Some(utt_split) = utt_split {
Expand Down

0 comments on commit 7e59a23

Please sign in to comment.