Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
},
"enable-wire-tests": true
},
"originGitCommit": "14c0ca94fcd0279d99570389d7b688dc3a18ea41",
"originGitCommit": "ff8fd2b74fdd5c081e9f111d59d3619f7e286dd8",
"originGitCommitIsDirty": true,
"invokedBy": "manual",
"sdkVersion": "0.6.1"
"sdkVersion": "0.6.2"
}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ You can learn more about the Deepgram API at [developers.deepgram.com](https://d

### Migrating Between Versions

- [v0.3 to v0.4](./docs/Migrating-v0.3-to-v0.4.md) (current)
- [v0.6 to v0.7](./docs/Migrating-v0.6-to-v0.7.md) (current)
- [v0.5 to v0.6](./docs/Migrating-v0.5-to-v0.6.md)
- [v0.3 to v0.4](./docs/Migrating-v0.3-to-v0.4.md)
- [v0.2 to v0.3](./docs/Migrating-v0.2-to-v0.3.md)

## Installation
Expand Down
127 changes: 127 additions & 0 deletions docs/Migrating-v0.6-to-v0.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# v0.6 to v0.7 Migration Guide

This guide helps you migrate from Deepgram Java SDK v0.6.x to v0.7.0. The `0.7.0` release is still pre-`1.0`, and it ships one breaking source change from the July 20 SDK regeneration along with two additive features.

The breaking change is **source/compile-time** only. The on-the-wire payloads are unchanged — your requests and responses still serialize the same way; only one field was removed from the Java API surface because the API removed it from the spec.

The biggest change is:

1. `AgentV1LatencyReport.getSttLatency()` was removed — the Voice Agent `LatencyReport` no longer reports `stt_latency` ([deepgram-docs #1006](https://github.com/deepgram/deepgram-docs/pull/1006)). Drop any reads of `getSttLatency()`; the remaining latency getters are unchanged.

## Table of Contents

- [Installation](#installation)
- [Configuration Changes](#configuration-changes)
- [Authentication Changes](#authentication-changes)
- [API Method Changes](#api-method-changes)
- [Agent V1 (WebSocket)](#agent-v1-websocket)
- [Listen V2 (WebSocket)](#listen-v2-websocket)
- [Type Changes](#type-changes)
- [Latency Report STT Latency Removal](#latency-report-stt-latency-removal)
- [Other Additive Types](#other-additive-types)
- [Breaking Changes Summary](#breaking-changes-summary)

## Installation

Upgrade to `0.7.0` with Gradle or Maven.

**Gradle**

```groovy
dependencies {
implementation 'com.deepgram:deepgram-java-sdk:0.7.0'
}
```

**Maven**

```xml
<dependency>
<groupId>com.deepgram</groupId>
<artifactId>deepgram-java-sdk</artifactId>
<version>0.7.0</version>
</dependency>
```

## Configuration Changes

No required client-construction changes. Existing `DeepgramClient.builder()` usage still works.

## Authentication Changes

No changes. API key, access token, and session ID configuration all work the same as in `0.6.x`.

## API Method Changes

### Agent V1 (WebSocket)

No breaking client-method changes. The breaking change is on the `AgentV1LatencyReport` server-event **type** you receive in an agent session (see [Type Changes](#type-changes)).

### Listen V2 (WebSocket)

No breaking client-method changes. `0.7.0` adds an optional `numerals` query parameter to the V2 WebSocket connection via `V2ConnectOptions`. It is additive.

## Type Changes

### Latency Report STT Latency Removal

The Voice Agent `LatencyReport` server event no longer includes `stt_latency`, so `AgentV1LatencyReport.getSttLatency()` and the `sttLatency(...)` builder methods were removed. `LatencyReport` is a server-emitted (read-only) message, so this has **no request/wire impact** — but any call site that read `getSttLatency()` will no longer compile.

The remaining latency getters are unchanged: `getTttTokenLatency()`, `getTttTextLatency()`, `getTttToolLatency()`, `getTttThinkingLatency()`, `getTtsLatency()`, and `getTotalLatency()`.

**v0.6.x**

```java
report.getSttLatency().ifPresent(stt -> System.out.println("STT latency: " + stt));
report.getTtsLatency().ifPresent(tts -> System.out.println("TTS latency: " + tts));
```

**v0.7.0**

```java
// stt_latency is no longer reported by the server; drop the read.
report.getTtsLatency().ifPresent(tts -> System.out.println("TTS latency: " + tts));
```

If you need to tolerate an `stt_latency` value on the wire from an older server, it is still accessible through the type's additional (unknown) properties rather than a typed getter.

### Other Additive Types

`0.7.0` also adds new generated types and constants that do not require migration unless you want to use them:

- **Flux STT `numerals`**: a new `ListenV2Numerals` type (`com.deepgram.types.ListenV2Numerals`, values `TRUE` / `FALSE`) and an optional `numerals` query parameter on the Listen V2 WebSocket connection via `V2ConnectOptions.numerals(...)`. It renders spoken numbers as digits in the transcript (for example, "twenty three" → "23"). Connection-time only.

```java
import com.deepgram.resources.listen.v2.websocket.V2ConnectOptions;
import com.deepgram.types.ListenV2Model;
import com.deepgram.types.ListenV2Numerals;

wsClient.connect(V2ConnectOptions.builder()
.model(ListenV2Model.FLUX_GENERAL_EN)
.numerals(ListenV2Numerals.TRUE)
.build());
```

- **New Aura-2 multilingual TTS voices**: roughly 40 new voices were added across `SpeakV1Model` (streaming/`speak.v2`) and `AudioGenerateRequestModel` (REST/`speak.v1.audio.generate`), covering Italian, Dutch, Spanish, German, Japanese, and French (for example, `SpeakV1Model.AURA2AURELIA_DE`, wire name `aura-2-aurelia-de`). Purely additive — existing voice constants are unchanged.

## Breaking Changes Summary

### Major Changes

1. **Latency report STT removal**: `AgentV1LatencyReport.getSttLatency()` and the `sttLatency(...)` builder methods removed; the server no longer emits `stt_latency`.

### Removed or Renamed Features

- `AgentV1LatencyReport.getSttLatency()` and `AgentV1LatencyReport.Builder.sttLatency(...)`

### New Features in v0.7.0

- **Flux STT numerals**: `ListenV2Numerals` and the `numerals` V2 WebSocket query parameter (`V2ConnectOptions.numerals(...)`)
- **New Aura-2 multilingual TTS voices**: ~40 voices added to `SpeakV1Model` and `AudioGenerateRequestModel` (it/nl/es/de/ja/fr)

### Migration Checklist

- [ ] Upgrade to `com.deepgram:deepgram-java-sdk:0.7.0`
- [ ] Remove any reads of `AgentV1LatencyReport.getSttLatency()` and any `sttLatency(...)` builder calls
- [ ] Rebuild your project and fix any remaining references to the removed getter
- [ ] (Optional) Adopt `V2ConnectOptions.numerals(...)` and the new Aura-2 multilingual voices
3 changes: 3 additions & 0 deletions examples/listen/LiveStreamingV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.deepgram.resources.listen.v2.websocket.V2ConnectOptions;
import com.deepgram.resources.listen.v2.websocket.V2WebSocketClient;
import com.deepgram.types.ListenV2Model;
import com.deepgram.types.ListenV2Numerals;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -65,6 +66,8 @@ public static void main(String[] args) {
// Connect to the WebSocket
CompletableFuture<Void> connectFuture = wsClient.connect(V2ConnectOptions.builder()
.model(ListenV2Model.FLUX_GENERAL_EN)
// Render spoken numbers as digits in the transcript (e.g. "twenty three" -> "23").
.numerals(ListenV2Numerals.TRUE)
.build());
connectFuture.get(10, TimeUnit.SECONDS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = AgentV1LatencyReport.Builder.class)
public final class AgentV1LatencyReport {
private final Optional<Float> sttLatency;

private final Optional<Float> tttTokenLatency;

private final Optional<Float> tttTextLatency;
Expand All @@ -37,15 +35,13 @@ public final class AgentV1LatencyReport {
private final Map<String, Object> additionalProperties;

private AgentV1LatencyReport(
Optional<Float> sttLatency,
Optional<Float> tttTokenLatency,
Optional<Float> tttTextLatency,
Optional<Float> tttToolLatency,
Optional<Float> tttThinkingLatency,
Optional<Float> ttsLatency,
Optional<Float> totalLatency,
Map<String, Object> additionalProperties) {
this.sttLatency = sttLatency;
this.tttTokenLatency = tttTokenLatency;
this.tttTextLatency = tttTextLatency;
this.tttToolLatency = tttToolLatency;
Expand All @@ -63,14 +59,6 @@ public String getType() {
return "LatencyReport";
}

/**
* @return Speech-to-text: time from audio received to transcript produced, in seconds
*/
@JsonProperty("stt_latency")
public Optional<Float> getSttLatency() {
return sttLatency;
}

/**
* @return Time to first token of any type (text, tool call, or thinking), in seconds
*/
Expand Down Expand Up @@ -131,8 +119,7 @@ public Map<String, Object> getAdditionalProperties() {
}

private boolean equalTo(AgentV1LatencyReport other) {
return sttLatency.equals(other.sttLatency)
&& tttTokenLatency.equals(other.tttTokenLatency)
return tttTokenLatency.equals(other.tttTokenLatency)
&& tttTextLatency.equals(other.tttTextLatency)
&& tttToolLatency.equals(other.tttToolLatency)
&& tttThinkingLatency.equals(other.tttThinkingLatency)
Expand All @@ -143,7 +130,6 @@ private boolean equalTo(AgentV1LatencyReport other) {
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.sttLatency,
this.tttTokenLatency,
this.tttTextLatency,
this.tttToolLatency,
Expand All @@ -163,8 +149,6 @@ public static Builder builder() {

@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<Float> sttLatency = Optional.empty();

private Optional<Float> tttTokenLatency = Optional.empty();

private Optional<Float> tttTextLatency = Optional.empty();
Expand All @@ -183,7 +167,6 @@ public static final class Builder {
private Builder() {}

public Builder from(AgentV1LatencyReport other) {
sttLatency(other.getSttLatency());
tttTokenLatency(other.getTttTokenLatency());
tttTextLatency(other.getTttTextLatency());
tttToolLatency(other.getTttToolLatency());
Expand All @@ -193,20 +176,6 @@ public Builder from(AgentV1LatencyReport other) {
return this;
}

/**
* <p>Speech-to-text: time from audio received to transcript produced, in seconds</p>
*/
@JsonSetter(value = "stt_latency", nulls = Nulls.SKIP)
public Builder sttLatency(Optional<Float> sttLatency) {
this.sttLatency = sttLatency;
return this;
}

public Builder sttLatency(Float sttLatency) {
this.sttLatency = Optional.ofNullable(sttLatency);
return this;
}

/**
* <p>Time to first token of any type (text, tool call, or thinking), in seconds</p>
*/
Expand Down Expand Up @@ -293,7 +262,6 @@ public Builder totalLatency(Float totalLatency) {

public AgentV1LatencyReport build() {
return new AgentV1LatencyReport(
sttLatency,
tttTokenLatency,
tttTextLatency,
tttToolLatency,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.deepgram.types.ListenV2LanguageHint;
import com.deepgram.types.ListenV2MipOptOut;
import com.deepgram.types.ListenV2Model;
import com.deepgram.types.ListenV2Numerals;
import com.deepgram.types.ListenV2ProfanityFilter;
import com.deepgram.types.ListenV2SampleRate;
import com.deepgram.types.ListenV2Tag;
Expand Down Expand Up @@ -50,6 +51,8 @@ public final class V2ConnectOptions {

private final Optional<ListenV2ProfanityFilter> profanityFilter;

private final Optional<ListenV2Numerals> numerals;

private final Optional<ListenV2MipOptOut> mipOptOut;

private final Optional<ListenV2Tag> tag;
Expand All @@ -66,6 +69,7 @@ private V2ConnectOptions(
Optional<ListenV2Keyterm> keyterm,
Optional<ListenV2LanguageHint> languageHint,
Optional<ListenV2ProfanityFilter> profanityFilter,
Optional<ListenV2Numerals> numerals,
Optional<ListenV2MipOptOut> mipOptOut,
Optional<ListenV2Tag> tag,
Map<String, Object> additionalProperties) {
Expand All @@ -78,6 +82,7 @@ private V2ConnectOptions(
this.keyterm = keyterm;
this.languageHint = languageHint;
this.profanityFilter = profanityFilter;
this.numerals = numerals;
this.mipOptOut = mipOptOut;
this.tag = tag;
this.additionalProperties = additionalProperties;
Expand Down Expand Up @@ -128,6 +133,11 @@ public Optional<ListenV2ProfanityFilter> getProfanityFilter() {
return profanityFilter;
}

@JsonProperty("numerals")
public Optional<ListenV2Numerals> getNumerals() {
return numerals;
}

@JsonProperty("mip_opt_out")
public Optional<ListenV2MipOptOut> getMipOptOut() {
return mipOptOut;
Expand Down Expand Up @@ -159,6 +169,7 @@ private boolean equalTo(V2ConnectOptions other) {
&& keyterm.equals(other.keyterm)
&& languageHint.equals(other.languageHint)
&& profanityFilter.equals(other.profanityFilter)
&& numerals.equals(other.numerals)
&& mipOptOut.equals(other.mipOptOut)
&& tag.equals(other.tag);
}
Expand All @@ -175,6 +186,7 @@ public int hashCode() {
this.keyterm,
this.languageHint,
this.profanityFilter,
this.numerals,
this.mipOptOut,
this.tag);
}
Expand Down Expand Up @@ -233,6 +245,10 @@ public interface _FinalStage {

_FinalStage profanityFilter(ListenV2ProfanityFilter profanityFilter);

_FinalStage numerals(Optional<ListenV2Numerals> numerals);

_FinalStage numerals(ListenV2Numerals numerals);

_FinalStage mipOptOut(Optional<ListenV2MipOptOut> mipOptOut);

_FinalStage mipOptOut(ListenV2MipOptOut mipOptOut);
Expand All @@ -250,6 +266,8 @@ public static final class Builder implements ModelStage, _FinalStage {

private Optional<ListenV2MipOptOut> mipOptOut = Optional.empty();

private Optional<ListenV2Numerals> numerals = Optional.empty();

private Optional<ListenV2ProfanityFilter> profanityFilter = Optional.empty();

private Optional<ListenV2LanguageHint> languageHint = Optional.empty();
Expand Down Expand Up @@ -282,6 +300,7 @@ public Builder from(V2ConnectOptions other) {
keyterm(other.getKeyterm());
languageHint(other.getLanguageHint());
profanityFilter(other.getProfanityFilter());
numerals(other.getNumerals());
mipOptOut(other.getMipOptOut());
tag(other.getTag());
return this;
Expand Down Expand Up @@ -320,6 +339,19 @@ public _FinalStage mipOptOut(Optional<ListenV2MipOptOut> mipOptOut) {
return this;
}

@java.lang.Override
public _FinalStage numerals(ListenV2Numerals numerals) {
this.numerals = Optional.ofNullable(numerals);
return this;
}

@java.lang.Override
@JsonSetter(value = "numerals", nulls = Nulls.SKIP)
public _FinalStage numerals(Optional<ListenV2Numerals> numerals) {
this.numerals = numerals;
return this;
}

@java.lang.Override
public _FinalStage profanityFilter(ListenV2ProfanityFilter profanityFilter) {
this.profanityFilter = Optional.ofNullable(profanityFilter);
Expand Down Expand Up @@ -436,6 +468,7 @@ public V2ConnectOptions build() {
keyterm,
languageHint,
profanityFilter,
numerals,
mipOptOut,
tag,
additionalProperties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ public CompletableFuture<Void> connect(V2ConnectOptions options) {
"profanity_filter",
String.valueOf(options.getProfanityFilter().get()));
}
if (options.getNumerals() != null && options.getNumerals().isPresent()) {
urlBuilder.addQueryParameter(
"numerals", String.valueOf(options.getNumerals().get()));
}
if (options.getMipOptOut() != null && options.getMipOptOut().isPresent()) {
urlBuilder.addQueryParameter(
"mip_opt_out", String.valueOf(options.getMipOptOut().get()));
Expand Down
Loading
Loading