diff --git a/.fern/metadata.json b/.fern/metadata.json
index 3c25483..79d535d 100644
--- a/.fern/metadata.json
+++ b/.fern/metadata.json
@@ -12,7 +12,7 @@
"enable-wire-tests": true,
"runtime-version": true
},
- "originGitCommit": "59a99c27e5f91158072fc98b3567fc88c3315f67",
+ "originGitCommit": "3063c73a3a1dabef36c44211e69ea5e5c1f2b8f0",
"originGitCommitIsDirty": true,
"invokedBy": "manual",
"sdkVersion": "0.11.1"
diff --git a/.fernignore b/.fernignore
index 001477f..b2aa665 100644
--- a/.fernignore
+++ b/.fernignore
@@ -25,6 +25,7 @@ src/main/java/com/deepgram/core/transport/
# (thrown by the frozen listen v1 V1WebSocketClient below when no onErrorMessage handler is set).
# No Fern equivalent; the generator would delete it.
src/main/java/com/deepgram/resources/listen/v1/websocket/ListenV1ErrorException.java
+src/main/java/com/deepgram/resources/listen/v1/websocket/ListenV1ConfigureFailureException.java
# Bug fixes for maxRetries(0) semantics ("connect once, don't retry") and a
# configurable connectionTimeoutMs on ReconnectOptions (was hardcoded 4000ms).
@@ -57,6 +58,12 @@ src/main/java/com/deepgram/resources/listen/v2/websocket/V2WebSocketClient.java
src/main/java/com/deepgram/resources/listen/v1/websocket/V1WebSocketClient.java
src/main/java/com/deepgram/resources/speak/v1/websocket/V1WebSocketClient.java
+# Source and binary compatibility for third-party implementations of generated builder stages.
+# Generated concrete builders override languageHint; default interface methods preserve existing custom implementations.
+src/main/java/com/deepgram/resources/listen/v1/websocket/V1ConnectOptions.java
+src/main/java/com/deepgram/resources/listen/v1/media/requests/ListenV1RequestUrl.java
+src/main/java/com/deepgram/resources/listen/v1/media/requests/MediaTranscribeRequestOctetStream.java
+
# Restores the FLUX_RENEE_EN constant that generator 4.18.0 dropped. The voice is live:
# POST /v2/speak?model=flux-renee-en returns 200 with valid audio, and the name resolves in the
# server's model registry (an invented flux-* name is rejected with INVALID_QUERY_PARAMETER), so the
diff --git a/AGENTS.md b/AGENTS.md
index ecec18a..db5bfd6 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -26,7 +26,7 @@ Current permanently frozen files:
- `src/main/java/com/deepgram/DeepgramClient.java`, `src/main/java/com/deepgram/AsyncDeepgramClient.java`, `src/main/java/com/deepgram/DeepgramClientBuilder.java`, `src/main/java/com/deepgram/AsyncDeepgramClientBuilder.java` - custom wrapper entrypoints that add Bearer auth, session ID support, and custom transport behavior on top of Fern's generated API client
- `src/main/java/com/deepgram/core/transport/` - hand-written transport abstraction
-- `src/main/java/com/deepgram/resources/listen/v1/websocket/ListenV1ErrorException.java` - hand-written exception carrying a Listen V1 server `Error` (`ListenV1Error`) to the generic `onError` handler when no `onErrorMessage` handler is registered; thrown by the frozen listen v1 `V1WebSocketClient`. No Fern equivalent
+- `src/main/java/com/deepgram/resources/listen/v1/websocket/ListenV1ErrorException.java` and `src/main/java/com/deepgram/resources/listen/v1/websocket/ListenV1ConfigureFailureException.java` - hand-written exceptions carrying Listen V1 server `Error` and `ConfigureFailure` frames to the generic `onError` handler when no typed handler is registered; thrown by the frozen listen v1 `V1WebSocketClient`. No Fern equivalent
- `build.gradle`, `settings.gradle`, `gradle/`, `gradlew`, `gradlew.bat`, `mvnw`, `mvnw.cmd`, `.mvn/`, `pom.xml`, `Makefile` - build and project configuration
- `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `LICENSE`, `docs/` - docs
- `src/test/` - manually maintained tests
@@ -50,8 +50,9 @@ Current temporarily frozen files:
- `src/main/java/com/deepgram/core/ClientOptions.java` - preserves release-please version markers, correct SDK header constants, and the accurate `close()` lifecycle Javadoc that Fern currently overwrites; use the standard `.bak` swap/restore workflow during regen review. Since generator 4.18.0 Fern emits a `getSdkVersion()` helper reading `Package.getImplementationVersion()` instead of a literal. That *does* resolve in the published artifact (CI publishes via `./mvnw deploy -P release`, and `pom.xml`'s maven-jar-plugin sets `addDefaultImplementationEntries=true`, so the JAR manifest carries `Implementation-Version`), but it resolves to `null` under Gradle and in tests, where it silently falls back to a hardcoded literal the generator does not keep current. We keep the explicit literals because they are correct in every context and because `.github/release-please-config.json` already lists this file in `extra-files`, so release-please bumps it alongside `pom.xml`, `build.gradle`, and `.fern/metadata.json`. Fern also emits `User-Agent` with a `com.deepgram.` prefix while leaving `X-Fern-SDK-Name` on the `com.deepgram:` Maven-coordinate form; we keep both on the colon form. Fern 4.22.1 tracks and closes child WebSockets before shutting down SDK-owned OkHttp resources; the permanent custom client wrappers inherit it, so do not add wrapper-local lifecycle code and retain Fern's lifecycle implementation during reconciliation.
- `src/main/java/com/deepgram/core/ReconnectingWebSocketListener.java` - carries bug fixes for `maxRetries(0)` semantics ("connect once, don't retry") and a configurable `connectionTimeoutMs` field (was hardcoded 4000ms), plus an `applyOptionsOverride(...)` hook used by `TransportWebSocketFactory` to apply per-transport reconnect policy; pull this back out once the fixes are upstreamed into the Fern generator. Use the standard `.bak` swap/restore workflow during regen review.
-- `src/main/java/com/deepgram/resources/speak/v2/websocket/V2WebSocketClient.java` and `src/main/java/com/deepgram/resources/listen/v2/websocket/V2WebSocketClient.java` - forward-compat patch (both clients). Fern's generated `handleIncomingMessage` dispatcher routes any unrecognized message type to `onError` with "Update your SDK version...", which makes a benign new server control frame look fatal to a deployed client. Patched so the unrecognized-type branch is a no-op — the raw frame is already delivered via `onMessage(String)` earlier in the method, so consumers still see it. Mirrors the JS/Python SDKs' forward-compat behavior and is regression-guarded by `src/test/java/com/deepgram/SpeakV2ForwardCompatTest.java` and `src/test/java/com/deepgram/ListenV2ForwardCompatTest.java`. These two clients also carry the streaming query-param patches described in the next entry. Use the standard `.bak` swap/restore workflow during regen review; re-apply the no-op to both after regen, and unfreeze once the generator stops treating unknown frames as errors.
+- `src/main/java/com/deepgram/resources/speak/v2/websocket/V2WebSocketClient.java` and `src/main/java/com/deepgram/resources/listen/v2/websocket/V2WebSocketClient.java` - forward-compat patch (both clients). Fern's generated `handleIncomingMessage` dispatcher routes any unrecognized message type to `onError` with "Update your SDK version...", which makes a benign new server control frame look fatal to a deployed client. Patched so the unrecognized-type branch is a no-op — the raw frame is already delivered via `onMessage(String)` earlier in the method, so consumers still see it. Mirrors the JS/Python SDKs' forward-compat behavior and is regression-guarded by `src/test/java/com/deepgram/SpeakV2ForwardCompatTest.java` and `src/test/java/com/deepgram/ListenV2ForwardCompatTest.java`. These two clients also carry the streaming query-param patches described in the next entry. Listen V2 additionally tracks a successfully sent `CloseStream` and treats a following no-status (`1005`) close as terminal; queued or rejected controls still reconnect, and `src/test/java/com/deepgram/ListenV2ServerCloseTest.java` guards all three paths. Use the standard `.bak` swap/restore workflow during regen review; re-apply the no-op and terminal-close safeguards after regen.
- `src/main/java/com/deepgram/resources/listen/v1/websocket/V1WebSocketClient.java` and `src/main/java/com/deepgram/resources/speak/v1/websocket/V1WebSocketClient.java` (and the v2 clients above) - streaming query-param patches on the generated `connect()` builders. Two fixes: (1) multi-value serialization — array-valued params (listen: `keyterm`, `keywords`, `replace`, `search`, `tag`, `extra`, `language_hint`; speak: `tag`) were serialized with `String.valueOf(union.get())`, collapsing a `List` into one param (`keyterm=[a, b]`) instead of repeats (`keyterm=a&keyterm=b`); (2) an `additionalProperties` escape hatch — the builder exposes `additionalProperty(key, value)` for unmodeled params (e.g. `no_delay`) but `connect()` never emitted them to the URL. Both patched to route through `QueryStringMapper(arraysAsRepeats=true)`, matching the REST path. Listen V1 also forwards a parsed server `Error` to `onError` as a `ListenV1ErrorException` (carrying the typed `ListenV1Error`) when no `onErrorMessage` handler is registered, preserving the prior generic error-handler behavior. Use the standard `.bak` swap/restore workflow during regen review; re-apply after regen and unfreeze once the generator emits array params as repeats and serializes `additionalProperties` on the WS `connect()` path (tracked as an upstream Fern request).
+- `src/main/java/com/deepgram/resources/listen/v1/websocket/V1ConnectOptions.java`, `src/main/java/com/deepgram/resources/listen/v1/media/requests/ListenV1RequestUrl.java`, and `src/main/java/com/deepgram/resources/listen/v1/media/requests/MediaTranscribeRequestOctetStream.java` - keep newly added `languageHint(...)` methods on public `_FinalStage` builder interfaces as default no-ops. Generated concrete builders override them normally; the defaults preserve source and binary compatibility for third-party implementations compiled before the optional setting existed. Re-apply after regen until Fern emits compatible defaults.
- Fields-less message types carrying a manual `hashCode()` patch (Fern generates `equals()` but no `hashCode()` for these, violating the Object contract): `src/main/java/com/deepgram/resources/listen/v2/types/ListenV2CloseStream.java`, `src/main/java/com/deepgram/resources/listen/v2/types/ListenV2ForceEndTurn.java`, `src/main/java/com/deepgram/resources/speak/v2/types/SpeakV2Close.java`, `src/main/java/com/deepgram/resources/speak/v2/types/SpeakV2Flush.java`, and the `AgentV1*` event types `src/main/java/com/deepgram/resources/agent/v1/types/{AgentV1ListenUpdated,AgentV1SpeakUpdated,AgentV1AgentAudioDone,AgentV1SettingsApplied,AgentV1UserStartedSpeaking,AgentV1KeepAlive,AgentV1ThinkUpdated,AgentV1PromptUpdated,AgentV1ForceEndTurn}.java`. Use the standard `.bak` swap/restore workflow during regen review; drop the patches and unfreeze all of them once the generator emits a matching equals/hashCode pair for fields-less types (tracked as an upstream Fern request).
- `src/main/java/com/deepgram/types/DeepgramModel.java` - restores the `FLUX_RENEE_EN` constant that generator 4.18.0 dropped. Renee is an unlisted voice: the spec owner removed it from the catalog on purpose (#project-flux-tts, 2026-08-19), but it still synthesizes (`POST /v2/speak?model=flux-renee-en` returns 200 with valid audio), so dropping the constant would be a source break for 0.8.0+ callers over a catalog delisting alone. The constant and its `Visitor` method are marked `@Deprecated` with a note pointing callers to a listed voice. Five touchpoints: the constant, the `Value` enum entry, the `visit()` case, the `valueOf()` case, and the `Visitor` method (the constant and `Visitor` method carry the `@Deprecated` tag and Javadoc). **This file is unlike the other temporarily frozen ones — it receives frequent additive spec changes (4.18.0 alone added 25 constants), so on the next regen do NOT restore the `.bak` wholesale.** Diff the `.bak` against the newly generated file, carry forward every new voice, and re-apply only the `FLUX_RENEE_EN` touchpoints. The spec will not list the voice again, so drop the Renee touchpoints at the next major release; keep the file frozen until then for the reasons above.
- Union default-variant fix on the agent listen-provider unions: `src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateListenListenProvider.java`, `src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListenProvider.java`, `src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextListenProvider.java`. `version` is an optional discriminator, so a provider payload without it is valid (and is what 0.7.x emits), but Fern points `@JsonTypeInfo` `defaultImpl` at the empty-bodied `_UnknownValue`, so such a payload deserializes to an unknown variant carrying `null` — `getProvider()` returns `null` and re-serialization emits `{"provider":null}`, silently dropping the provider on the wire. Patched to `defaultImpl = V2Value` on each; guarded by `src/test/java/com/deepgram/AgentSettingsProviderDefaultTest.java`. Use the standard `.bak` swap/restore workflow during regen review; drop the patches and unfreeze once the generator stops defaulting unions to the empty `_UnknownValue` (tracked as an upstream Fern request).
diff --git a/README.md b/README.md
index aeade6c..c1dbc1c 100644
--- a/README.md
+++ b/README.md
@@ -295,6 +295,14 @@ ws.onErrorMessage(error -> {
System.err.println("Server error: " + error.getVariant() + ": " + error.getDescription());
});
+ws.onConfigureSuccess(success -> {
+ System.out.println("Configuration applied: " + success.getRequestId());
+});
+
+ws.onConfigureFailure(failure -> {
+ System.err.println("Configuration rejected: " + failure.getCode() + ": " + failure.getDescription());
+});
+
// Connect with options (model is required)
ws.connect(V1ConnectOptions.builder()
.model(ListenV1Model.NOVA3)
@@ -303,7 +311,7 @@ ws.connect(V1ConnectOptions.builder()
// Update Nova-3 keyterms and numerals without reconnecting. Keep the keyterm list under the
// 500-token limit: an over-limit update does not close the stream, and the server may reply
-// with a ConfigureFailure (CONFIGURE_KEYTERM_LIMIT_EXCEEDED), which this client reports to onError.
+// with a typed ConfigureFailure (CONFIGURE_KEYTERM_LIMIT_EXCEEDED).
ws.sendConfigure(ListenV1Configure.builder()
.keyterms(List.of("Deepgram"))
.features(Map.of("numerals", true))
@@ -320,6 +328,56 @@ ws.sendCloseStream(ListenV1CloseStream.builder()
ws.close();
```
+### Nova-3 multilingual language hints
+
+With `model=nova-3` and `language=multi`, `language_hint` biases language detection toward the languages you expect; it does not restrict the transcript to them, and it is ignored with any other `language`. Each alternative carries the detected `languages` and the normalized `languages_hinted` (an empty list when no hint was sent). A code outside the Nova-3 multilingual list fails the request with HTTP 400.
+
+```java
+import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl;
+import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestModel;
+import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse;
+import com.deepgram.resources.listen.v1.websocket.V1ConnectOptions;
+import com.deepgram.resources.listen.v1.websocket.V1WebSocketClient;
+import com.deepgram.types.ListenV1AcceptedResponse;
+import com.deepgram.types.ListenV1Language;
+import com.deepgram.types.ListenV1LanguageHint;
+import com.deepgram.types.ListenV1Model;
+import com.deepgram.types.ListenV1Response;
+
+// Pre-recorded (MediaTranscribeResponse is a union type; see "Access transcription" above)
+MediaTranscribeResponse result = client.listen().v1().media().transcribeUrl(ListenV1RequestUrl.builder()
+ .url("https://dpgr.am/spacewalk.wav")
+ .model(MediaTranscribeRequestModel.NOVA3)
+ .language("multi")
+ .languageHint(List.of("en", "es"))
+ .build());
+result.visit(new MediaTranscribeResponse.Visitor() {
+ @Override
+ public Void visit(ListenV1Response response) {
+ response.getResults().getChannels().get(0).getAlternatives().ifPresent(alts -> {
+ alts.get(0).getLanguagesHinted().ifPresent(hinted -> System.out.println("Hints applied: " + hinted));
+ alts.get(0).getLanguages().ifPresent(detected -> System.out.println("Detected: " + detected));
+ });
+ return null;
+ }
+
+ @Override
+ public Void visit(ListenV1AcceptedResponse accepted) {
+ return null;
+ }
+
+});
+
+// Streaming
+V1WebSocketClient ws = client.listen().v1().v1WebSocket();
+ws.connect(V1ConnectOptions.builder()
+ .model(ListenV1Model.NOVA3)
+ .language(ListenV1Language.of("multi"))
+ .languageHint(ListenV1LanguageHint.of(List.of("en", "es")))
+ .build())
+ .get(10, TimeUnit.SECONDS);
+```
+
### Flux Transcription (Listen V2 WebSocket)
Flux supports turn-aware streaming transcription. Set `numerals` when connecting, or change it for turns transcribed
diff --git a/examples/listen/LiveReconfigure.java b/examples/listen/LiveReconfigure.java
index af027be..0ef40a8 100644
--- a/examples/listen/LiveReconfigure.java
+++ b/examples/listen/LiveReconfigure.java
@@ -16,8 +16,7 @@
* Reconfigures an active Nova-3 Listen V1 stream without reconnecting.
*
* Keep the keyterm list under the 500-token limit: an over-limit update does not close the stream, and the server
- * may reply with a {@code ConfigureFailure} ({@code CONFIGURE_KEYTERM_LIMIT_EXCEEDED}), which this client reports to
- * {@code onError}.
+ * may reply with a typed {@code ConfigureFailure} ({@code CONFIGURE_KEYTERM_LIMIT_EXCEEDED}).
*
*
Usage: {@code DEEPGRAM_API_KEY=... java LiveReconfigure}
*/
@@ -32,6 +31,7 @@ public static void main(String[] args) {
DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build();
V1WebSocketClient wsClient = client.listen().v1().v1WebSocket();
CountDownLatch closeLatch = new CountDownLatch(1);
+ CountDownLatch configureLatch = new CountDownLatch(1);
try {
wsClient.onConnected(() -> System.out.println("Connected to Deepgram"));
@@ -48,6 +48,15 @@ public static void main(String[] args) {
}
});
wsClient.onErrorMessage(LiveReconfigure::printListenError);
+ wsClient.onConfigureSuccess(success -> {
+ System.out.println("Configuration applied: request_id=" + success.getRequestId());
+ success.getKeyterms().ifPresent(keyterms -> System.out.println("Active keyterms: " + keyterms));
+ configureLatch.countDown();
+ });
+ wsClient.onConfigureFailure(failure -> {
+ System.err.println("Configuration rejected (" + failure.getCode() + "): " + failure.getDescription());
+ configureLatch.countDown();
+ });
wsClient.onError(error -> System.err.println("WebSocket error occurred: " + error.getMessage()));
wsClient.onDisconnected(reason -> {
System.out.println("Connection closed.");
@@ -65,6 +74,9 @@ public static void main(String[] args) {
.build())
.get(10, TimeUnit.SECONDS);
System.out.println("Sent live reconfiguration for keyterms and numerals.");
+ if (!configureLatch.await(10, TimeUnit.SECONDS)) {
+ throw new IllegalStateException("Timed out waiting for ConfigureSuccess or ConfigureFailure");
+ }
// Stream audio after this point, for example: wsClient.sendMedia(audioChunk);
wsClient.sendCloseStream(ListenV1CloseStream.builder()
diff --git a/examples/listen/LiveStreaming.java b/examples/listen/LiveStreaming.java
index bfc2bf2..7e8706d 100644
--- a/examples/listen/LiveStreaming.java
+++ b/examples/listen/LiveStreaming.java
@@ -4,6 +4,8 @@
import com.deepgram.resources.listen.v1.types.ListenV1ResultsChannelAlternativesItem;
import com.deepgram.resources.listen.v1.websocket.V1ConnectOptions;
import com.deepgram.resources.listen.v1.websocket.V1WebSocketClient;
+import com.deepgram.types.ListenV1Language;
+import com.deepgram.types.ListenV1LanguageHint;
import com.deepgram.types.ListenV1Model;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
@@ -53,6 +55,7 @@ public static void main(String[] args) {
String label = isFinal ? "[final] " : "[interim]";
System.out.printf("%s %s%n", label, transcript);
}
+ alt.getLanguagesHinted().ifPresent(hints -> System.out.println("Language hints: " + hints));
}
});
@@ -79,8 +82,11 @@ public static void main(String[] args) {
});
// Connect to the WebSocket
- CompletableFuture connectFuture = wsClient.connect(
- V1ConnectOptions.builder().model(ListenV1Model.NOVA3).build());
+ CompletableFuture connectFuture = wsClient.connect(V1ConnectOptions.builder()
+ .model(ListenV1Model.NOVA3)
+ .language(ListenV1Language.of("multi"))
+ .languageHint(ListenV1LanguageHint.of(java.util.List.of("en", "es")))
+ .build());
connectFuture.get(10, TimeUnit.SECONDS);
System.out.println("WebSocket connected. In a real application, you would stream");
diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/AsyncRawMediaClient.java b/src/main/java/com/deepgram/resources/listen/v1/media/AsyncRawMediaClient.java
index 203d243..d1bf59f 100644
--- a/src/main/java/com/deepgram/resources/listen/v1/media/AsyncRawMediaClient.java
+++ b/src/main/java/com/deepgram/resources/listen/v1/media/AsyncRawMediaClient.java
@@ -195,6 +195,10 @@ public CompletableFuture> trans
QueryStringMapper.addQueryParameter(
httpUrl, "keywords", request.getKeywords().get(), true);
}
+ if (request.getLanguageHint().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "language_hint", request.getLanguageHint().get(), true);
+ }
if (request.getReplace().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "replace", request.getReplace().get(), true);
@@ -448,6 +452,10 @@ public CompletableFuture> trans
QueryStringMapper.addQueryParameter(
httpUrl, "keywords", request.getKeywords().get(), true);
}
+ if (request.getLanguageHint().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "language_hint", request.getLanguageHint().get(), true);
+ }
if (request.getReplace().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "replace", request.getReplace().get(), true);
diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/RawMediaClient.java b/src/main/java/com/deepgram/resources/listen/v1/media/RawMediaClient.java
index b0114e5..1572611 100644
--- a/src/main/java/com/deepgram/resources/listen/v1/media/RawMediaClient.java
+++ b/src/main/java/com/deepgram/resources/listen/v1/media/RawMediaClient.java
@@ -190,6 +190,10 @@ public DeepgramApiHttpResponse transcribeUrl(
QueryStringMapper.addQueryParameter(
httpUrl, "keywords", request.getKeywords().get(), true);
}
+ if (request.getLanguageHint().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "language_hint", request.getLanguageHint().get(), true);
+ }
if (request.getReplace().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "replace", request.getReplace().get(), true);
@@ -426,6 +430,10 @@ public DeepgramApiHttpResponse transcribeFile(
QueryStringMapper.addQueryParameter(
httpUrl, "keywords", request.getKeywords().get(), true);
}
+ if (request.getLanguageHint().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "language_hint", request.getLanguageHint().get(), true);
+ }
if (request.getReplace().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "replace", request.getReplace().get(), true);
diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/requests/ListenV1RequestUrl.java b/src/main/java/com/deepgram/resources/listen/v1/media/requests/ListenV1RequestUrl.java
index 4d5df0c..448c459 100644
--- a/src/main/java/com/deepgram/resources/listen/v1/media/requests/ListenV1RequestUrl.java
+++ b/src/main/java/com/deepgram/resources/listen/v1/media/requests/ListenV1RequestUrl.java
@@ -44,6 +44,8 @@ public final class ListenV1RequestUrl {
private final Optional> keywords;
+ private final Optional> languageHint;
+
private final Optional> replace;
private final Optional> search;
@@ -117,6 +119,7 @@ private ListenV1RequestUrl(
Optional> customIntent,
Optional> keyterm,
Optional> keywords,
+ Optional> languageHint,
Optional> replace,
Optional> search,
Optional callback,
@@ -156,6 +159,7 @@ private ListenV1RequestUrl(
this.customIntent = customIntent;
this.keyterm = keyterm;
this.keywords = keywords;
+ this.languageHint = languageHint;
this.replace = replace;
this.search = search;
this.callback = callback;
@@ -241,6 +245,14 @@ public Optional> getKeywords() {
return keywords;
}
+ /**
+ * @return Biases language detection toward one or more languages on Nova-3 multilingual (model=nova-3&language=multi); ignored with any other language. Repeat the parameter to pass several codes, for example language_hint=en&language_hint=es. A code that is not in the Nova-3 multilingual list fails the request with HTTP 400. See Nova-3 Language Prompting.
+ */
+ @JsonIgnore
+ public Optional> getLanguageHint() {
+ return languageHint;
+ }
+
/**
* @return Search for terms or phrases in submitted audio and replaces them
*/
@@ -512,6 +524,7 @@ private boolean equalTo(ListenV1RequestUrl other) {
&& customIntent.equals(other.customIntent)
&& keyterm.equals(other.keyterm)
&& keywords.equals(other.keywords)
+ && languageHint.equals(other.languageHint)
&& replace.equals(other.replace)
&& search.equals(other.search)
&& callback.equals(other.callback)
@@ -555,6 +568,7 @@ public int hashCode() {
this.customIntent,
this.keyterm,
this.keywords,
+ this.languageHint,
this.replace,
this.search,
this.callback,
@@ -667,6 +681,21 @@ public interface _FinalStage {
_FinalStage keywords(String keywords);
+ /**
+ * Biases language detection toward one or more languages on Nova-3 multilingual (model=nova-3&language=multi); ignored with any other language. Repeat the parameter to pass several codes, for example language_hint=en&language_hint=es. A code that is not in the Nova-3 multilingual list fails the request with HTTP 400. See Nova-3 Language Prompting.
+ */
+ default _FinalStage languageHint(Optional> languageHint) {
+ return this;
+ }
+
+ default _FinalStage languageHint(List languageHint) {
+ return this;
+ }
+
+ default _FinalStage languageHint(String languageHint) {
+ return this;
+ }
+
/**
* Search for terms or phrases in submitted audio and replaces them
*/
@@ -955,6 +984,8 @@ public static final class Builder implements UrlStage, _FinalStage {
private Optional> replace = Optional.empty();
+ private Optional> languageHint = Optional.empty();
+
private Optional> keywords = Optional.empty();
private Optional> keyterm = Optional.empty();
@@ -980,6 +1011,7 @@ public Builder from(ListenV1RequestUrl other) {
customIntent(other.getCustomIntent());
keyterm(other.getKeyterm());
keywords(other.getKeywords());
+ languageHint(other.getLanguageHint());
replace(other.getReplace());
search(other.getSearch());
callback(other.getCallback());
@@ -1654,6 +1686,32 @@ public _FinalStage replace(Optional> replace) {
return this;
}
+ @java.lang.Override
+ public _FinalStage languageHint(String languageHint) {
+ this.languageHint = Optional.of(Collections.singletonList(languageHint));
+ return this;
+ }
+
+ /**
+ * Biases language detection toward one or more languages on Nova-3 multilingual (model=nova-3&language=multi); ignored with any other language. Repeat the parameter to pass several codes, for example language_hint=en&language_hint=es. A code that is not in the Nova-3 multilingual list fails the request with HTTP 400. See Nova-3 Language Prompting.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage languageHint(List languageHint) {
+ this.languageHint = Optional.ofNullable(languageHint);
+ return this;
+ }
+
+ /**
+ * Biases language detection toward one or more languages on Nova-3 multilingual (model=nova-3&language=multi); ignored with any other language. Repeat the parameter to pass several codes, for example language_hint=en&language_hint=es. A code that is not in the Nova-3 multilingual list fails the request with HTTP 400. See Nova-3 Language Prompting.
+ */
+ @java.lang.Override
+ @JsonSetter(value = "language_hint", nulls = Nulls.SKIP)
+ public _FinalStage languageHint(Optional> languageHint) {
+ this.languageHint = languageHint;
+ return this;
+ }
+
@java.lang.Override
public _FinalStage keywords(String keywords) {
this.keywords = Optional.of(Collections.singletonList(keywords));
@@ -1823,6 +1881,7 @@ public ListenV1RequestUrl build() {
customIntent,
keyterm,
keywords,
+ languageHint,
replace,
search,
callback,
diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/requests/MediaTranscribeRequestOctetStream.java b/src/main/java/com/deepgram/resources/listen/v1/media/requests/MediaTranscribeRequestOctetStream.java
index 96779e4..f094b06 100644
--- a/src/main/java/com/deepgram/resources/listen/v1/media/requests/MediaTranscribeRequestOctetStream.java
+++ b/src/main/java/com/deepgram/resources/listen/v1/media/requests/MediaTranscribeRequestOctetStream.java
@@ -43,6 +43,8 @@ public final class MediaTranscribeRequestOctetStream {
private final Optional> keywords;
+ private final Optional> languageHint;
+
private final Optional> replace;
private final Optional> search;
@@ -116,6 +118,7 @@ private MediaTranscribeRequestOctetStream(
Optional> customIntent,
Optional> keyterm,
Optional> keywords,
+ Optional> languageHint,
Optional> replace,
Optional> search,
Optional callback,
@@ -155,6 +158,7 @@ private MediaTranscribeRequestOctetStream(
this.customIntent = customIntent;
this.keyterm = keyterm;
this.keywords = keywords;
+ this.languageHint = languageHint;
this.replace = replace;
this.search = search;
this.callback = callback;
@@ -240,6 +244,14 @@ public Optional> getKeywords() {
return keywords;
}
+ /**
+ * @return Biases language detection toward one or more languages on Nova-3 multilingual (model=nova-3&language=multi); ignored with any other language. Repeat the parameter to pass several codes, for example language_hint=en&language_hint=es. A code that is not in the Nova-3 multilingual list fails the request with HTTP 400. See Nova-3 Language Prompting.
+ */
+ @JsonProperty("language_hint")
+ public Optional> getLanguageHint() {
+ return languageHint;
+ }
+
/**
* @return Search for terms or phrases in submitted audio and replaces them
*/
@@ -511,6 +523,7 @@ private boolean equalTo(MediaTranscribeRequestOctetStream other) {
&& customIntent.equals(other.customIntent)
&& keyterm.equals(other.keyterm)
&& keywords.equals(other.keywords)
+ && languageHint.equals(other.languageHint)
&& replace.equals(other.replace)
&& search.equals(other.search)
&& callback.equals(other.callback)
@@ -554,6 +567,7 @@ public int hashCode() {
this.customIntent,
this.keyterm,
this.keywords,
+ this.languageHint,
this.replace,
this.search,
this.callback,
@@ -666,6 +680,21 @@ public interface _FinalStage {
_FinalStage keywords(String keywords);
+ /**
+ * Biases language detection toward one or more languages on Nova-3 multilingual (model=nova-3&language=multi); ignored with any other language. Repeat the parameter to pass several codes, for example language_hint=en&language_hint=es. A code that is not in the Nova-3 multilingual list fails the request with HTTP 400. See Nova-3 Language Prompting.
+ */
+ default _FinalStage languageHint(Optional> languageHint) {
+ return this;
+ }
+
+ default _FinalStage languageHint(List languageHint) {
+ return this;
+ }
+
+ default _FinalStage languageHint(String languageHint) {
+ return this;
+ }
+
/**
* Search for terms or phrases in submitted audio and replaces them
*/
@@ -954,6 +983,8 @@ public static final class Builder implements BodyStage, _FinalStage {
private Optional> replace = Optional.empty();
+ private Optional> languageHint = Optional.empty();
+
private Optional> keywords = Optional.empty();
private Optional> keyterm = Optional.empty();
@@ -979,6 +1010,7 @@ public Builder from(MediaTranscribeRequestOctetStream other) {
customIntent(other.getCustomIntent());
keyterm(other.getKeyterm());
keywords(other.getKeywords());
+ languageHint(other.getLanguageHint());
replace(other.getReplace());
search(other.getSearch());
callback(other.getCallback());
@@ -1653,6 +1685,32 @@ public _FinalStage replace(Optional> replace) {
return this;
}
+ @java.lang.Override
+ public _FinalStage languageHint(String languageHint) {
+ this.languageHint = Optional.of(Collections.singletonList(languageHint));
+ return this;
+ }
+
+ /**
+ * Biases language detection toward one or more languages on Nova-3 multilingual (model=nova-3&language=multi); ignored with any other language. Repeat the parameter to pass several codes, for example language_hint=en&language_hint=es. A code that is not in the Nova-3 multilingual list fails the request with HTTP 400. See Nova-3 Language Prompting.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage languageHint(List languageHint) {
+ this.languageHint = Optional.ofNullable(languageHint);
+ return this;
+ }
+
+ /**
+ * Biases language detection toward one or more languages on Nova-3 multilingual (model=nova-3&language=multi); ignored with any other language. Repeat the parameter to pass several codes, for example language_hint=en&language_hint=es. A code that is not in the Nova-3 multilingual list fails the request with HTTP 400. See Nova-3 Language Prompting.
+ */
+ @java.lang.Override
+ @JsonSetter(value = "language_hint", nulls = Nulls.SKIP)
+ public _FinalStage languageHint(Optional> languageHint) {
+ this.languageHint = languageHint;
+ return this;
+ }
+
@java.lang.Override
public _FinalStage keywords(String keywords) {
this.keywords = Optional.of(Collections.singletonList(keywords));
@@ -1822,6 +1880,7 @@ public MediaTranscribeRequestOctetStream build() {
customIntent,
keyterm,
keywords,
+ languageHint,
replace,
search,
callback,
diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Configure.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Configure.java
index 4232f3f..a1813bc 100644
--- a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Configure.java
+++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Configure.java
@@ -46,13 +46,12 @@ public String getType() {
/**
* @return Replaces the stream's keyterms. Compatible with all Nova-3 models, monolingual and multilingual; on other
- * models the server returns an Error with code KeytermsNotSupported. Each array replaces the entire list,
- * including keyterms set with the keyterm query parameter. Send an empty array to clear all keyterms. Omit
- * the field, or set it to null, to keep the current keyterms.
+ * models the server returns a ConfigureFailure with code CONFIGURE_KEYTERMS_NOT_SUPPORTED. Each array
+ * replaces the entire list, including keyterms set with the keyterm query parameter. Send an empty array to
+ * clear all keyterms. Omit the field, or set it to null, to keep the current keyterms.
* Each entry is a plain term or phrase with no weights or intensifiers. The 500-token keyterm limit that
- * applies to the keyterm query parameter also applies to each update. An over-limit update currently stops
- * transcription without an Error; after about 30 seconds, the server closes the stream with 1011
- * (NET-0000). Keep each list under the limit and check its size before sending.
+ * applies to the keyterm query parameter also applies to each update. An over-limit update returns a
+ * ConfigureFailure with code CONFIGURE_KEYTERM_LIMIT_EXCEEDED.
*/
@JsonProperty("keyterms")
public Optional> getKeyterms() {
@@ -116,13 +115,12 @@ public Builder from(ListenV1Configure other) {
/**
* Replaces the stream's keyterms. Compatible with all Nova-3 models, monolingual and multilingual; on other
- * models the server returns an Error with code KeytermsNotSupported. Each array replaces the entire list,
- * including keyterms set with the keyterm query parameter. Send an empty array to clear all keyterms. Omit
- * the field, or set it to null, to keep the current keyterms.
+ * models the server returns a ConfigureFailure with code CONFIGURE_KEYTERMS_NOT_SUPPORTED. Each array
+ * replaces the entire list, including keyterms set with the keyterm query parameter. Send an empty array to
+ * clear all keyterms. Omit the field, or set it to null, to keep the current keyterms.
* Each entry is a plain term or phrase with no weights or intensifiers. The 500-token keyterm limit that
- * applies to the keyterm query parameter also applies to each update. An over-limit update currently stops
- * transcription without an Error; after about 30 seconds, the server closes the stream with 1011
- * (NET-0000). Keep each list under the limit and check its size before sending.
+ * applies to the keyterm query parameter also applies to each update. An over-limit update returns a
+ * ConfigureFailure with code CONFIGURE_KEYTERM_LIMIT_EXCEEDED.
*/
@JsonSetter(value = "keyterms", nulls = Nulls.SKIP)
public Builder keyterms(Optional> keyterms) {
diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ConfigureFailure.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ConfigureFailure.java
new file mode 100644
index 0000000..3fe16d1
--- /dev/null
+++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ConfigureFailure.java
@@ -0,0 +1,225 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.deepgram.resources.listen.v1.types;
+
+import com.deepgram.core.ObjectMappers;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import org.jetbrains.annotations.NotNull;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = ListenV1ConfigureFailure.Builder.class)
+public final class ListenV1ConfigureFailure {
+ private final String requestId;
+
+ private final ListenV1ConfigureFailureCode code;
+
+ private final String description;
+
+ private final Map additionalProperties;
+
+ private ListenV1ConfigureFailure(
+ String requestId,
+ ListenV1ConfigureFailureCode code,
+ String description,
+ Map additionalProperties) {
+ this.requestId = requestId;
+ this.code = code;
+ this.description = description;
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return Message type identifier
+ */
+ @JsonProperty("type")
+ public String getType() {
+ return "ConfigureFailure";
+ }
+
+ /**
+ * @return The unique identifier of the request
+ */
+ @JsonProperty("request_id")
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * @return Identifies why the Configure was rejected.
+ *
+ * CONFIGURE_KEYTERMS_NOT_SUPPORTED: the stream's model does not support mid-stream keyterm updates. Only
+ * Nova-3 models do.
+ * CONFIGURE_KEYTERM_LIMIT_EXCEEDED: the keyterms exceed the 500-token keyterm limit.
+ * CONFIGURE_ALREADY_PENDING: another Configure is still awaiting its response.
+ * CONFIGURE_INTERNAL_ERROR: the server failed to apply the configuration.
+ *
+ */
+ @JsonProperty("code")
+ public ListenV1ConfigureFailureCode getCode() {
+ return code;
+ }
+
+ /**
+ * @return A human-readable explanation of the rejection
+ */
+ @JsonProperty("description")
+ public String getDescription() {
+ return description;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof ListenV1ConfigureFailure && equalTo((ListenV1ConfigureFailure) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(ListenV1ConfigureFailure other) {
+ return requestId.equals(other.requestId) && code.equals(other.code) && description.equals(other.description);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.requestId, this.code, this.description);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static RequestIdStage builder() {
+ return new Builder();
+ }
+
+ public interface RequestIdStage {
+ /**
+ * The unique identifier of the request
+ */
+ CodeStage requestId(@NotNull String requestId);
+
+ Builder from(ListenV1ConfigureFailure other);
+ }
+
+ public interface CodeStage {
+ /**
+ * Identifies why the Configure was rejected.
+ *
+ * CONFIGURE_KEYTERMS_NOT_SUPPORTED: the stream's model does not support mid-stream keyterm updates. Only
+ * Nova-3 models do.
+ * CONFIGURE_KEYTERM_LIMIT_EXCEEDED: the keyterms exceed the 500-token keyterm limit.
+ * CONFIGURE_ALREADY_PENDING: another Configure is still awaiting its response.
+ * CONFIGURE_INTERNAL_ERROR: the server failed to apply the configuration.
+ *
+ */
+ DescriptionStage code(@NotNull ListenV1ConfigureFailureCode code);
+ }
+
+ public interface DescriptionStage {
+ /**
+ * A human-readable explanation of the rejection
+ */
+ _FinalStage description(@NotNull String description);
+ }
+
+ public interface _FinalStage {
+ ListenV1ConfigureFailure build();
+
+ _FinalStage additionalProperty(String key, Object value);
+
+ _FinalStage additionalProperties(Map additionalProperties);
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder implements RequestIdStage, CodeStage, DescriptionStage, _FinalStage {
+ private String requestId;
+
+ private ListenV1ConfigureFailureCode code;
+
+ private String description;
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ @java.lang.Override
+ public Builder from(ListenV1ConfigureFailure other) {
+ requestId(other.getRequestId());
+ code(other.getCode());
+ description(other.getDescription());
+ return this;
+ }
+
+ /**
+ * The unique identifier of the request
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ @JsonSetter("request_id")
+ public CodeStage requestId(@NotNull String requestId) {
+ this.requestId = Objects.requireNonNull(requestId, "requestId must not be null");
+ return this;
+ }
+
+ /**
+ * Identifies why the Configure was rejected.
+ *
+ * CONFIGURE_KEYTERMS_NOT_SUPPORTED: the stream's model does not support mid-stream keyterm updates. Only
+ * Nova-3 models do.
+ * CONFIGURE_KEYTERM_LIMIT_EXCEEDED: the keyterms exceed the 500-token keyterm limit.
+ * CONFIGURE_ALREADY_PENDING: another Configure is still awaiting its response.
+ * CONFIGURE_INTERNAL_ERROR: the server failed to apply the configuration.
+ *
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ @JsonSetter("code")
+ public DescriptionStage code(@NotNull ListenV1ConfigureFailureCode code) {
+ this.code = Objects.requireNonNull(code, "code must not be null");
+ return this;
+ }
+
+ /**
+ * A human-readable explanation of the rejection
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ @JsonSetter("description")
+ public _FinalStage description(@NotNull String description) {
+ this.description = Objects.requireNonNull(description, "description must not be null");
+ return this;
+ }
+
+ @java.lang.Override
+ public ListenV1ConfigureFailure build() {
+ return new ListenV1ConfigureFailure(requestId, code, description, additionalProperties);
+ }
+
+ @java.lang.Override
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ @java.lang.Override
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
+ }
+}
diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ConfigureFailureCode.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ConfigureFailureCode.java
new file mode 100644
index 0000000..578ba9e
--- /dev/null
+++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ConfigureFailureCode.java
@@ -0,0 +1,110 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.deepgram.resources.listen.v1.types;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+public final class ListenV1ConfigureFailureCode {
+ public static final ListenV1ConfigureFailureCode CONFIGURE_KEYTERMS_NOT_SUPPORTED =
+ new ListenV1ConfigureFailureCode(
+ Value.CONFIGURE_KEYTERMS_NOT_SUPPORTED, "CONFIGURE_KEYTERMS_NOT_SUPPORTED");
+
+ public static final ListenV1ConfigureFailureCode CONFIGURE_INTERNAL_ERROR =
+ new ListenV1ConfigureFailureCode(Value.CONFIGURE_INTERNAL_ERROR, "CONFIGURE_INTERNAL_ERROR");
+
+ public static final ListenV1ConfigureFailureCode CONFIGURE_KEYTERM_LIMIT_EXCEEDED =
+ new ListenV1ConfigureFailureCode(
+ Value.CONFIGURE_KEYTERM_LIMIT_EXCEEDED, "CONFIGURE_KEYTERM_LIMIT_EXCEEDED");
+
+ public static final ListenV1ConfigureFailureCode CONFIGURE_ALREADY_PENDING =
+ new ListenV1ConfigureFailureCode(Value.CONFIGURE_ALREADY_PENDING, "CONFIGURE_ALREADY_PENDING");
+
+ private final Value value;
+
+ private final String string;
+
+ ListenV1ConfigureFailureCode(Value value, String string) {
+ this.value = value;
+ this.string = string;
+ }
+
+ public Value getEnumValue() {
+ return value;
+ }
+
+ @java.lang.Override
+ @JsonValue
+ public String toString() {
+ return this.string;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ return (this == other)
+ || (other instanceof ListenV1ConfigureFailureCode
+ && this.string.equals(((ListenV1ConfigureFailureCode) other).string));
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return this.string.hashCode();
+ }
+
+ public T visit(Visitor visitor) {
+ switch (value) {
+ case CONFIGURE_KEYTERMS_NOT_SUPPORTED:
+ return visitor.visitConfigureKeytermsNotSupported();
+ case CONFIGURE_INTERNAL_ERROR:
+ return visitor.visitConfigureInternalError();
+ case CONFIGURE_KEYTERM_LIMIT_EXCEEDED:
+ return visitor.visitConfigureKeytermLimitExceeded();
+ case CONFIGURE_ALREADY_PENDING:
+ return visitor.visitConfigureAlreadyPending();
+ case UNKNOWN:
+ default:
+ return visitor.visitUnknown(string);
+ }
+ }
+
+ @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
+ public static ListenV1ConfigureFailureCode valueOf(String value) {
+ switch (value) {
+ case "CONFIGURE_KEYTERMS_NOT_SUPPORTED":
+ return CONFIGURE_KEYTERMS_NOT_SUPPORTED;
+ case "CONFIGURE_INTERNAL_ERROR":
+ return CONFIGURE_INTERNAL_ERROR;
+ case "CONFIGURE_KEYTERM_LIMIT_EXCEEDED":
+ return CONFIGURE_KEYTERM_LIMIT_EXCEEDED;
+ case "CONFIGURE_ALREADY_PENDING":
+ return CONFIGURE_ALREADY_PENDING;
+ default:
+ return new ListenV1ConfigureFailureCode(Value.UNKNOWN, value);
+ }
+ }
+
+ public enum Value {
+ CONFIGURE_KEYTERMS_NOT_SUPPORTED,
+
+ CONFIGURE_KEYTERM_LIMIT_EXCEEDED,
+
+ CONFIGURE_ALREADY_PENDING,
+
+ CONFIGURE_INTERNAL_ERROR,
+
+ UNKNOWN
+ }
+
+ public interface Visitor {
+ T visitConfigureKeytermsNotSupported();
+
+ T visitConfigureKeytermLimitExceeded();
+
+ T visitConfigureAlreadyPending();
+
+ T visitConfigureInternalError();
+
+ T visitUnknown(String unknownType);
+ }
+}
diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ConfigureSuccess.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ConfigureSuccess.java
new file mode 100644
index 0000000..221c8b0
--- /dev/null
+++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ConfigureSuccess.java
@@ -0,0 +1,181 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.deepgram.resources.listen.v1.types;
+
+import com.deepgram.core.ObjectMappers;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import org.jetbrains.annotations.NotNull;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = ListenV1ConfigureSuccess.Builder.class)
+public final class ListenV1ConfigureSuccess {
+ private final String requestId;
+
+ private final Optional> keyterms;
+
+ private final Map additionalProperties;
+
+ private ListenV1ConfigureSuccess(
+ String requestId, Optional> keyterms, Map additionalProperties) {
+ this.requestId = requestId;
+ this.keyterms = keyterms;
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return Message type identifier
+ */
+ @JsonProperty("type")
+ public String getType() {
+ return "ConfigureSuccess";
+ }
+
+ /**
+ * @return The unique identifier of the request
+ */
+ @JsonProperty("request_id")
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * @return The keyterms now in effect. Present only when the Configure replaced them.
+ */
+ @JsonProperty("keyterms")
+ public Optional> getKeyterms() {
+ return keyterms;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof ListenV1ConfigureSuccess && equalTo((ListenV1ConfigureSuccess) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(ListenV1ConfigureSuccess other) {
+ return requestId.equals(other.requestId) && keyterms.equals(other.keyterms);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.requestId, this.keyterms);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static RequestIdStage builder() {
+ return new Builder();
+ }
+
+ public interface RequestIdStage {
+ /**
+ * The unique identifier of the request
+ */
+ _FinalStage requestId(@NotNull String requestId);
+
+ Builder from(ListenV1ConfigureSuccess other);
+ }
+
+ public interface _FinalStage {
+ ListenV1ConfigureSuccess build();
+
+ _FinalStage additionalProperty(String key, Object value);
+
+ _FinalStage additionalProperties(Map additionalProperties);
+
+ /**
+ * The keyterms now in effect. Present only when the Configure replaced them.
+ */
+ _FinalStage keyterms(Optional> keyterms);
+
+ _FinalStage keyterms(List keyterms);
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder implements RequestIdStage, _FinalStage {
+ private String requestId;
+
+ private Optional> keyterms = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ @java.lang.Override
+ public Builder from(ListenV1ConfigureSuccess other) {
+ requestId(other.getRequestId());
+ keyterms(other.getKeyterms());
+ return this;
+ }
+
+ /**
+ * The unique identifier of the request
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ @JsonSetter("request_id")
+ public _FinalStage requestId(@NotNull String requestId) {
+ this.requestId = Objects.requireNonNull(requestId, "requestId must not be null");
+ return this;
+ }
+
+ /**
+ * The keyterms now in effect. Present only when the Configure replaced them.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage keyterms(List keyterms) {
+ this.keyterms = Optional.ofNullable(keyterms);
+ return this;
+ }
+
+ /**
+ * The keyterms now in effect. Present only when the Configure replaced them.
+ */
+ @java.lang.Override
+ @JsonSetter(value = "keyterms", nulls = Nulls.SKIP)
+ public _FinalStage keyterms(Optional> keyterms) {
+ this.keyterms = keyterms;
+ return this;
+ }
+
+ @java.lang.Override
+ public ListenV1ConfigureSuccess build() {
+ return new ListenV1ConfigureSuccess(requestId, keyterms, additionalProperties);
+ }
+
+ @java.lang.Override
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ @java.lang.Override
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
+ }
+}
diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Error.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Error.java
index fd0a4e0..a89cf9a 100644
--- a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Error.java
+++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Error.java
@@ -54,7 +54,6 @@ public String getType() {
/**
* @return The error category. SchemaError means the server could not parse a client text message.
- * InvalidConfigureMessage means the server rejected a Configure message.
*/
@JsonProperty("variant")
public String getVariant() {
@@ -70,8 +69,8 @@ public String getDescription() {
}
/**
- * @return Identifies the reason for an InvalidConfigureMessage error, for example KeytermsNotSupported
- * when keyterms are sent on a model other than Nova-3.
+ * @return Deprecated. Present only on legacy error frames; use ConfigureFailure.code for Configure
+ * rejections.
*/
@JsonProperty("code")
public Optional getCode() {
@@ -120,8 +119,7 @@ public static VariantStage builder() {
public interface VariantStage {
/**
- * The error category. SchemaError means the server could not parse a client text message.
- * InvalidConfigureMessage means the server rejected a Configure message.
+ * The error category. SchemaError means the server could not parse a client text message.
*/
DescriptionStage variant(@NotNull String variant);
@@ -143,8 +141,8 @@ public interface _FinalStage {
_FinalStage additionalProperties(Map additionalProperties);
/**
- * Identifies the reason for an InvalidConfigureMessage error, for example KeytermsNotSupported
- * when keyterms are sent on a model other than Nova-3.
+ * Deprecated. Present only on legacy error frames; use ConfigureFailure.code for Configure
+ * rejections.
*/
_FinalStage code(Optional code);
@@ -183,8 +181,7 @@ public Builder from(ListenV1Error other) {
}
/**
- * The error category. SchemaError means the server could not parse a client text message.
- * InvalidConfigureMessage means the server rejected a Configure message.
+ * The error category. SchemaError means the server could not parse a client text message.
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@@ -226,8 +223,8 @@ public _FinalStage message(Optional message) {
}
/**
- * Identifies the reason for an InvalidConfigureMessage error, for example KeytermsNotSupported
- * when keyterms are sent on a model other than Nova-3.
+ * Deprecated. Present only on legacy error frames; use ConfigureFailure.code for Configure
+ * rejections.
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@@ -237,8 +234,8 @@ public _FinalStage code(String code) {
}
/**
- * Identifies the reason for an InvalidConfigureMessage error, for example KeytermsNotSupported
- * when keyterms are sent on a model other than Nova-3.
+ * Deprecated. Present only on legacy error frames; use ConfigureFailure.code for Configure
+ * rejections.
*/
@java.lang.Override
@JsonSetter(value = "code", nulls = Nulls.SKIP)
diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItem.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItem.java
index 928064e..fb564ee 100644
--- a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItem.java
+++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItem.java
@@ -29,6 +29,8 @@ public final class ListenV1ResultsChannelAlternativesItem {
private final Optional> languages;
+ private final Optional> languagesHinted;
+
private final List words;
private final Map additionalProperties;
@@ -37,11 +39,13 @@ private ListenV1ResultsChannelAlternativesItem(
String transcript,
double confidence,
Optional> languages,
+ Optional> languagesHinted,
List words,
Map additionalProperties) {
this.transcript = transcript;
this.confidence = confidence;
this.languages = languages;
+ this.languagesHinted = languagesHinted;
this.words = words;
this.additionalProperties = additionalProperties;
}
@@ -62,11 +66,22 @@ public double getConfidence() {
return confidence;
}
+ /**
+ * @return BCP-47 language tags of the languages detected in the transcript, sorted by word count in descending order. Only present when language=multi. Can be absent on audio that switches languages.
+ */
@JsonProperty("languages")
public Optional> getLanguages() {
return languages;
}
+ /**
+ * @return The language_hint values set at connection time, normalized: codes are returned in canonical form (ES → es, zh-hk → zh-HK), and a regional code the model has no tag for is returned as its base language (en-GB → en). Present on interim and final results of every Nova-3 multilingual stream (model=nova-3&language=multi); an empty array when no language_hint was sent.
+ */
+ @JsonProperty("languages_hinted")
+ public Optional> getLanguagesHinted() {
+ return languagesHinted;
+ }
+
@JsonProperty("words")
public List getWords() {
return words;
@@ -88,12 +103,13 @@ private boolean equalTo(ListenV1ResultsChannelAlternativesItem other) {
return transcript.equals(other.transcript)
&& confidence == other.confidence
&& languages.equals(other.languages)
+ && languagesHinted.equals(other.languagesHinted)
&& words.equals(other.words);
}
@java.lang.Override
public int hashCode() {
- return Objects.hash(this.transcript, this.confidence, this.languages, this.words);
+ return Objects.hash(this.transcript, this.confidence, this.languages, this.languagesHinted, this.words);
}
@java.lang.Override
@@ -128,10 +144,20 @@ public interface _FinalStage {
_FinalStage additionalProperties(Map additionalProperties);
+ /**
+ * BCP-47 language tags of the languages detected in the transcript, sorted by word count in descending order. Only present when language=multi. Can be absent on audio that switches languages.
+ */
_FinalStage languages(Optional> languages);
_FinalStage languages(List languages);
+ /**
+ * The language_hint values set at connection time, normalized: codes are returned in canonical form (ES → es, zh-hk → zh-HK), and a regional code the model has no tag for is returned as its base language (en-GB → en). Present on interim and final results of every Nova-3 multilingual stream (model=nova-3&language=multi); an empty array when no language_hint was sent.
+ */
+ _FinalStage languagesHinted(Optional> languagesHinted);
+
+ _FinalStage languagesHinted(List languagesHinted);
+
_FinalStage words(List words);
_FinalStage addWords(ListenV1ResultsChannelAlternativesItemWordsItem words);
@@ -147,6 +173,8 @@ public static final class Builder implements TranscriptStage, ConfidenceStage, _
private List words = new ArrayList<>();
+ private Optional> languagesHinted = Optional.empty();
+
private Optional> languages = Optional.empty();
@JsonAnySetter
@@ -159,6 +187,7 @@ public Builder from(ListenV1ResultsChannelAlternativesItem other) {
transcript(other.getTranscript());
confidence(other.getConfidence());
languages(other.getLanguages());
+ languagesHinted(other.getLanguagesHinted());
words(other.getWords());
return this;
}
@@ -209,12 +238,39 @@ public _FinalStage words(List w
return this;
}
+ /**
+ * The language_hint values set at connection time, normalized: codes are returned in canonical form (ES → es, zh-hk → zh-HK), and a regional code the model has no tag for is returned as its base language (en-GB → en). Present on interim and final results of every Nova-3 multilingual stream (model=nova-3&language=multi); an empty array when no language_hint was sent.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage languagesHinted(List languagesHinted) {
+ this.languagesHinted = Optional.ofNullable(languagesHinted);
+ return this;
+ }
+
+ /**
+ * The language_hint values set at connection time, normalized: codes are returned in canonical form (ES → es, zh-hk → zh-HK), and a regional code the model has no tag for is returned as its base language (en-GB → en). Present on interim and final results of every Nova-3 multilingual stream (model=nova-3&language=multi); an empty array when no language_hint was sent.
+ */
+ @java.lang.Override
+ @JsonSetter(value = "languages_hinted", nulls = Nulls.SKIP)
+ public _FinalStage languagesHinted(Optional> languagesHinted) {
+ this.languagesHinted = languagesHinted;
+ return this;
+ }
+
+ /**
+ * BCP-47 language tags of the languages detected in the transcript, sorted by word count in descending order. Only present when language=multi. Can be absent on audio that switches languages.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
@java.lang.Override
public _FinalStage languages(List languages) {
this.languages = Optional.ofNullable(languages);
return this;
}
+ /**
+ * BCP-47 language tags of the languages detected in the transcript, sorted by word count in descending order. Only present when language=multi. Can be absent on audio that switches languages.
+ */
@java.lang.Override
@JsonSetter(value = "languages", nulls = Nulls.SKIP)
public _FinalStage languages(Optional> languages) {
@@ -225,7 +281,7 @@ public _FinalStage languages(Optional> languages) {
@java.lang.Override
public ListenV1ResultsChannelAlternativesItem build() {
return new ListenV1ResultsChannelAlternativesItem(
- transcript, confidence, languages, words, additionalProperties);
+ transcript, confidence, languages, languagesHinted, words, additionalProperties);
}
@java.lang.Override
diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItemWordsItem.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItemWordsItem.java
index e84e7e7..988220e 100644
--- a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItemWordsItem.java
+++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItemWordsItem.java
@@ -89,7 +89,7 @@ public double getConfidence() {
}
/**
- * @return The language of the word
+ * @return BCP-47 language tag of the word's detected language. Only present when language=multi. Can be absent on audio that switches languages.
*/
@JsonProperty("language")
public Optional getLanguage() {
@@ -187,7 +187,7 @@ public interface _FinalStage {
_FinalStage additionalProperties(Map additionalProperties);
/**
- * The language of the word
+ * BCP-47 language tag of the word's detected language. Only present when language=multi. Can be absent on audio that switches languages.
*/
_FinalStage language(Optional language);
@@ -326,7 +326,7 @@ public _FinalStage punctuatedWord(Optional punctuatedWord) {
}
/**
- * The language of the word
+ * BCP-47 language tag of the word's detected language. Only present when language=multi. Can be absent on audio that switches languages.
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@@ -336,7 +336,7 @@ public _FinalStage language(String language) {
}
/**
- * The language of the word
+ * BCP-47 language tag of the word's detected language. Only present when language=multi. Can be absent on audio that switches languages.
*/
@java.lang.Override
@JsonSetter(value = "language", nulls = Nulls.SKIP)
diff --git a/src/main/java/com/deepgram/resources/listen/v1/websocket/ListenV1ConfigureFailureException.java b/src/main/java/com/deepgram/resources/listen/v1/websocket/ListenV1ConfigureFailureException.java
new file mode 100644
index 0000000..d569f4d
--- /dev/null
+++ b/src/main/java/com/deepgram/resources/listen/v1/websocket/ListenV1ConfigureFailureException.java
@@ -0,0 +1,26 @@
+package com.deepgram.resources.listen.v1.websocket;
+
+import com.deepgram.core.DeepgramApiException;
+import com.deepgram.resources.listen.v1.types.ListenV1ConfigureFailure;
+
+/**
+ * Carries a Listen V1 {@code ConfigureFailure} message to the generic {@code onError} handler
+ * when no {@code onConfigureFailure} handler is registered.
+ */
+public final class ListenV1ConfigureFailureException extends DeepgramApiException {
+ private final ListenV1ConfigureFailure failure;
+
+ public ListenV1ConfigureFailureException(ListenV1ConfigureFailure failure) {
+ super(buildMessage(failure));
+ this.failure = failure;
+ }
+
+ /** The Configure failure frame received from the server. */
+ public ListenV1ConfigureFailure getFailure() {
+ return failure;
+ }
+
+ private static String buildMessage(ListenV1ConfigureFailure failure) {
+ return failure.getCode() + ": " + failure.getDescription() + " (" + failure.getRequestId() + ")";
+ }
+}
diff --git a/src/main/java/com/deepgram/resources/listen/v1/websocket/V1ConnectOptions.java b/src/main/java/com/deepgram/resources/listen/v1/websocket/V1ConnectOptions.java
index 700f2cd..2694721 100644
--- a/src/main/java/com/deepgram/resources/listen/v1/websocket/V1ConnectOptions.java
+++ b/src/main/java/com/deepgram/resources/listen/v1/websocket/V1ConnectOptions.java
@@ -18,6 +18,7 @@
import com.deepgram.types.ListenV1Keyterm;
import com.deepgram.types.ListenV1Keywords;
import com.deepgram.types.ListenV1Language;
+import com.deepgram.types.ListenV1LanguageHint;
import com.deepgram.types.ListenV1MipOptOut;
import com.deepgram.types.ListenV1Model;
import com.deepgram.types.ListenV1Multichannel;
@@ -78,6 +79,8 @@ public final class V1ConnectOptions {
private final Optional language;
+ private final Optional languageHint;
+
private final Optional mipOptOut;
private final ListenV1Model model;
@@ -125,6 +128,7 @@ private V1ConnectOptions(
Optional keyterm,
Optional keywords,
Optional language,
+ Optional languageHint,
Optional mipOptOut,
ListenV1Model model,
Optional multichannel,
@@ -155,6 +159,7 @@ private V1ConnectOptions(
this.keyterm = keyterm;
this.keywords = keywords;
this.language = language;
+ this.languageHint = languageHint;
this.mipOptOut = mipOptOut;
this.model = model;
this.multichannel = multichannel;
@@ -249,6 +254,11 @@ public Optional getLanguage() {
return language;
}
+ @JsonProperty("language_hint")
+ public Optional getLanguageHint() {
+ return languageHint;
+ }
+
@JsonProperty("mip_opt_out")
public Optional getMipOptOut() {
return mipOptOut;
@@ -353,6 +363,7 @@ private boolean equalTo(V1ConnectOptions other) {
&& keyterm.equals(other.keyterm)
&& keywords.equals(other.keywords)
&& language.equals(other.language)
+ && languageHint.equals(other.languageHint)
&& mipOptOut.equals(other.mipOptOut)
&& model.equals(other.model)
&& multichannel.equals(other.multichannel)
@@ -387,6 +398,7 @@ public int hashCode() {
this.keyterm,
this.keywords,
this.language,
+ this.languageHint,
this.mipOptOut,
this.model,
this.multichannel,
@@ -491,6 +503,20 @@ public interface _FinalStage {
_FinalStage language(ListenV1Language language);
+ /**
+ * Biases language detection toward one or more languages on Nova-3 multilingual (model=nova-3&language=multi); ignored with any other language. Hints bias detection and do not restrict it. A list is sent as repeated language_hint query parameters, for example language_hint=en&language_hint=es. A code that is not in the Nova-3 multilingual list rejects the WebSocket connection with HTTP 400. See Nova-3 Language Prompting.
+ */
+ default _FinalStage languageHint(Optional languageHint) {
+ return this;
+ }
+
+ /**
+ * Biases language detection toward one or more languages on Nova-3 multilingual (model=nova-3&language=multi); ignored with any other language. Hints bias detection and do not restrict it. A list is sent as repeated language_hint query parameters, for example language_hint=en&language_hint=es. A code that is not in the Nova-3 multilingual list rejects the WebSocket connection with HTTP 400. See Nova-3 Language Prompting.
+ */
+ default _FinalStage languageHint(ListenV1LanguageHint languageHint) {
+ return this;
+ }
+
_FinalStage mipOptOut(Optional mipOptOut);
_FinalStage mipOptOut(ListenV1MipOptOut mipOptOut);
@@ -580,6 +606,8 @@ public static final class Builder implements ModelStage, _FinalStage {
private Optional mipOptOut = Optional.empty();
+ private Optional languageHint = Optional.empty();
+
private Optional language = Optional.empty();
private Optional keywords = Optional.empty();
@@ -629,6 +657,7 @@ public Builder from(V1ConnectOptions other) {
keyterm(other.getKeyterm());
keywords(other.getKeywords());
language(other.getLanguage());
+ languageHint(other.getLanguageHint());
mipOptOut(other.getMipOptOut());
model(other.getModel());
multichannel(other.getMultichannel());
@@ -840,6 +869,19 @@ public _FinalStage mipOptOut(Optional mipOptOut) {
return this;
}
+ @java.lang.Override
+ public _FinalStage languageHint(ListenV1LanguageHint languageHint) {
+ this.languageHint = Optional.ofNullable(languageHint);
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter(value = "language_hint", nulls = Nulls.SKIP)
+ public _FinalStage languageHint(Optional languageHint) {
+ this.languageHint = languageHint;
+ return this;
+ }
+
@java.lang.Override
public _FinalStage language(ListenV1Language language) {
this.language = Optional.ofNullable(language);
@@ -1053,6 +1095,7 @@ public V1ConnectOptions build() {
keyterm,
keywords,
language,
+ languageHint,
mipOptOut,
model,
multichannel,
diff --git a/src/main/java/com/deepgram/resources/listen/v1/websocket/V1WebSocketClient.java b/src/main/java/com/deepgram/resources/listen/v1/websocket/V1WebSocketClient.java
index e7cd50c..885f60c 100644
--- a/src/main/java/com/deepgram/resources/listen/v1/websocket/V1WebSocketClient.java
+++ b/src/main/java/com/deepgram/resources/listen/v1/websocket/V1WebSocketClient.java
@@ -12,6 +12,8 @@
import com.deepgram.core.WebSocketReadyState;
import com.deepgram.resources.listen.v1.types.ListenV1CloseStream;
import com.deepgram.resources.listen.v1.types.ListenV1Configure;
+import com.deepgram.resources.listen.v1.types.ListenV1ConfigureFailure;
+import com.deepgram.resources.listen.v1.types.ListenV1ConfigureSuccess;
import com.deepgram.resources.listen.v1.types.ListenV1Error;
import com.deepgram.resources.listen.v1.types.ListenV1Finalize;
import com.deepgram.resources.listen.v1.types.ListenV1KeepAlive;
@@ -60,6 +62,10 @@ public class V1WebSocketClient implements AutoCloseable {
private ReconnectingWebSocketListener reconnectingListener;
+ private volatile Consumer configureSuccessHandler;
+
+ private volatile Consumer configureFailureHandler;
+
private volatile Consumer resultsHandler;
private volatile Consumer metadataHandler;
@@ -160,6 +166,10 @@ public CompletableFuture connect(V1ConnectOptions options) {
urlBuilder.addQueryParameter(
"language", String.valueOf(options.getLanguage().get()));
}
+ if (options.getLanguageHint() != null && options.getLanguageHint().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ urlBuilder, "language_hint", options.getLanguageHint().get().get(), true);
+ }
if (options.getMipOptOut() != null && options.getMipOptOut().isPresent()) {
urlBuilder.addQueryParameter(
"mip_opt_out", String.valueOf(options.getMipOptOut().get()));
@@ -365,6 +375,22 @@ public CompletableFuture sendConfigure(ListenV1Configure message) {
return sendMessage(message);
}
+ /**
+ * Registers a handler for ListenV1ConfigureSuccess messages from the server.
+ * @param handler the handler to invoke when a message is received
+ */
+ public void onConfigureSuccess(Consumer handler) {
+ this.configureSuccessHandler = handler;
+ }
+
+ /**
+ * Registers a handler for ListenV1ConfigureFailure messages from the server.
+ * @param handler the handler to invoke when a message is received
+ */
+ public void onConfigureFailure(Consumer handler) {
+ this.configureFailureHandler = handler;
+ }
+
/**
* Registers a handler for ListenV1Results messages from the server.
* @param handler the handler to invoke when a message is received
@@ -531,6 +557,24 @@ private void handleIncomingMessage(String json) {
return;
}
}
+ if (node.has("request_id")
+ && node.has("code")
+ && node.has("description")
+ && "ConfigureFailure".equals(node.path("type").asText())) {
+ ListenV1ConfigureFailure configureFailureHandlerEvent = null;
+ try {
+ configureFailureHandlerEvent = objectMapper.treeToValue(node, ListenV1ConfigureFailure.class);
+ } catch (Exception e) {
+ }
+ if (configureFailureHandlerEvent != null) {
+ if (configureFailureHandler != null) {
+ configureFailureHandler.accept(configureFailureHandlerEvent);
+ } else if (onErrorHandler != null) {
+ onErrorHandler.accept(new ListenV1ConfigureFailureException(configureFailureHandlerEvent));
+ }
+ return;
+ }
+ }
if (node.has("channel")
&& node.has("last_word_end")
&& "UtteranceEnd".equals(node.path("type").asText())) {
@@ -578,6 +622,20 @@ private void handleIncomingMessage(String json) {
return;
}
}
+ if (node.has("request_id")
+ && "ConfigureSuccess".equals(node.path("type").asText())) {
+ ListenV1ConfigureSuccess configureSuccessHandlerEvent = null;
+ try {
+ configureSuccessHandlerEvent = objectMapper.treeToValue(node, ListenV1ConfigureSuccess.class);
+ } catch (Exception e) {
+ }
+ if (configureSuccessHandlerEvent != null) {
+ if (configureSuccessHandler != null) {
+ configureSuccessHandler.accept(configureSuccessHandlerEvent);
+ }
+ return;
+ }
+ }
if (onErrorHandler != null) {
onErrorHandler.accept(new RuntimeException(
"Unrecognized WebSocket message: " + json.substring(0, Math.min(200, json.length()))
diff --git a/src/main/java/com/deepgram/types/ListenV1LanguageHint.java b/src/main/java/com/deepgram/types/ListenV1LanguageHint.java
new file mode 100644
index 0000000..deb2122
--- /dev/null
+++ b/src/main/java/com/deepgram/types/ListenV1LanguageHint.java
@@ -0,0 +1,97 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.deepgram.types;
+
+import com.deepgram.core.ObjectMappers;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+
+@JsonDeserialize(using = ListenV1LanguageHint.Deserializer.class)
+public final class ListenV1LanguageHint {
+ private final Object value;
+
+ private final int type;
+
+ private ListenV1LanguageHint(Object value, int type) {
+ this.value = value;
+ this.type = type;
+ }
+
+ @JsonValue
+ public Object get() {
+ return this.value;
+ }
+
+ @SuppressWarnings("unchecked")
+ public T visit(Visitor visitor) {
+ if (this.type == 0) {
+ return visitor.visit((String) this.value);
+ } else if (this.type == 1) {
+ return visitor.visit((List) this.value);
+ }
+ throw new IllegalStateException("Failed to visit value. This should never happen.");
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof ListenV1LanguageHint && equalTo((ListenV1LanguageHint) other);
+ }
+
+ private boolean equalTo(ListenV1LanguageHint other) {
+ return value.equals(other.value);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.value);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return this.value.toString();
+ }
+
+ public static ListenV1LanguageHint of(String value) {
+ return new ListenV1LanguageHint(value, 0);
+ }
+
+ public static ListenV1LanguageHint of(List value) {
+ return new ListenV1LanguageHint(value, 1);
+ }
+
+ public interface Visitor {
+ T visit(String value);
+
+ T visit(List value);
+ }
+
+ static final class Deserializer extends StdDeserializer {
+ Deserializer() {
+ super(ListenV1LanguageHint.class);
+ }
+
+ @java.lang.Override
+ public ListenV1LanguageHint deserialize(JsonParser p, DeserializationContext context) throws IOException {
+ Object value = p.readValueAs(Object.class);
+ try {
+ return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class));
+ } catch (RuntimeException e) {
+ }
+ try {
+ return of(ObjectMappers.JSON_MAPPER.convertValue(value, new TypeReference>() {}));
+ } catch (RuntimeException e) {
+ }
+ throw new JsonParseException(p, "Failed to deserialize");
+ }
+ }
+}
diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItem.java
index bb197db..416a00f 100644
--- a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItem.java
+++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItem.java
@@ -25,6 +25,10 @@ public final class ListenV1ResponseResultsChannelsItemAlternativesItem {
private final Optional confidence;
+ private final Optional> languages;
+
+ private final Optional> languagesHinted;
+
private final Optional> words;
private final Optional paragraphs;
@@ -40,6 +44,8 @@ public final class ListenV1ResponseResultsChannelsItemAlternativesItem {
private ListenV1ResponseResultsChannelsItemAlternativesItem(
Optional transcript,
Optional confidence,
+ Optional> languages,
+ Optional> languagesHinted,
Optional> words,
Optional paragraphs,
Optional> entities,
@@ -48,6 +54,8 @@ private ListenV1ResponseResultsChannelsItemAlternativesItem(
Map additionalProperties) {
this.transcript = transcript;
this.confidence = confidence;
+ this.languages = languages;
+ this.languagesHinted = languagesHinted;
this.words = words;
this.paragraphs = paragraphs;
this.entities = entities;
@@ -66,6 +74,22 @@ public Optional getConfidence() {
return confidence;
}
+ /**
+ * @return BCP-47 language tags of the languages detected in the transcript, sorted by word count in descending order. Only present when language=multi. Can be absent on audio that switches languages.
+ */
+ @JsonProperty("languages")
+ public Optional> getLanguages() {
+ return languages;
+ }
+
+ /**
+ * @return The language_hint values for the request, normalized: codes are returned in canonical form (ES → es, zh-hk → zh-HK), and a regional code the model has no tag for is returned as its base language (en-GB → en). Returned on every Nova-3 multilingual response (model=nova-3&language=multi); an empty array when no language_hint was sent.
+ */
+ @JsonProperty("languages_hinted")
+ public Optional> getLanguagesHinted() {
+ return languagesHinted;
+ }
+
@JsonProperty("words")
public Optional> getWords() {
return words;
@@ -106,6 +130,8 @@ public Map getAdditionalProperties() {
private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItem other) {
return transcript.equals(other.transcript)
&& confidence.equals(other.confidence)
+ && languages.equals(other.languages)
+ && languagesHinted.equals(other.languagesHinted)
&& words.equals(other.words)
&& paragraphs.equals(other.paragraphs)
&& entities.equals(other.entities)
@@ -118,6 +144,8 @@ public int hashCode() {
return Objects.hash(
this.transcript,
this.confidence,
+ this.languages,
+ this.languagesHinted,
this.words,
this.paragraphs,
this.entities,
@@ -140,6 +168,10 @@ public static final class Builder {
private Optional confidence = Optional.empty();
+ private Optional> languages = Optional.empty();
+
+ private Optional> languagesHinted = Optional.empty();
+
private Optional> words = Optional.empty();
private Optional paragraphs = Optional.empty();
@@ -160,6 +192,8 @@ private Builder() {}
public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItem other) {
transcript(other.getTranscript());
confidence(other.getConfidence());
+ languages(other.getLanguages());
+ languagesHinted(other.getLanguagesHinted());
words(other.getWords());
paragraphs(other.getParagraphs());
entities(other.getEntities());
@@ -190,6 +224,34 @@ public Builder confidence(Float confidence) {
return this;
}
+ /**
+ * BCP-47 language tags of the languages detected in the transcript, sorted by word count in descending order. Only present when language=multi. Can be absent on audio that switches languages.
+ */
+ @JsonSetter(value = "languages", nulls = Nulls.SKIP)
+ public Builder languages(Optional> languages) {
+ this.languages = languages;
+ return this;
+ }
+
+ public Builder languages(List languages) {
+ this.languages = Optional.ofNullable(languages);
+ return this;
+ }
+
+ /**
+ * The language_hint values for the request, normalized: codes are returned in canonical form (ES → es, zh-hk → zh-HK), and a regional code the model has no tag for is returned as its base language (en-GB → en). Returned on every Nova-3 multilingual response (model=nova-3&language=multi); an empty array when no language_hint was sent.
+ */
+ @JsonSetter(value = "languages_hinted", nulls = Nulls.SKIP)
+ public Builder languagesHinted(Optional> languagesHinted) {
+ this.languagesHinted = languagesHinted;
+ return this;
+ }
+
+ public Builder languagesHinted(List languagesHinted) {
+ this.languagesHinted = Optional.ofNullable(languagesHinted);
+ return this;
+ }
+
@JsonSetter(value = "words", nulls = Nulls.SKIP)
public Builder words(Optional> words) {
this.words = words;
@@ -249,7 +311,16 @@ public Builder topics(List confidence;
+ private final Optional language;
+
private final Optional speaker;
private final Optional speakerConfidence;
@@ -39,6 +41,7 @@ private ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem(
Optional start,
Optional end,
Optional confidence,
+ Optional language,
Optional speaker,
Optional speakerConfidence,
Map additionalProperties) {
@@ -46,6 +49,7 @@ private ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem(
this.start = start;
this.end = end;
this.confidence = confidence;
+ this.language = language;
this.speaker = speaker;
this.speakerConfidence = speakerConfidence;
this.additionalProperties = additionalProperties;
@@ -71,6 +75,14 @@ public Optional getConfidence() {
return confidence;
}
+ /**
+ * @return BCP-47 language tag of the word's detected language. Only present when language=multi. Can be absent on audio that switches languages.
+ */
+ @JsonProperty("language")
+ public Optional getLanguage() {
+ return language;
+ }
+
/**
* @return The speaker of the word, present when diarization is enabled
*/
@@ -104,13 +116,15 @@ private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItemWords
&& start.equals(other.start)
&& end.equals(other.end)
&& confidence.equals(other.confidence)
+ && language.equals(other.language)
&& speaker.equals(other.speaker)
&& speakerConfidence.equals(other.speakerConfidence);
}
@java.lang.Override
public int hashCode() {
- return Objects.hash(this.word, this.start, this.end, this.confidence, this.speaker, this.speakerConfidence);
+ return Objects.hash(
+ this.word, this.start, this.end, this.confidence, this.language, this.speaker, this.speakerConfidence);
}
@java.lang.Override
@@ -132,6 +146,8 @@ public static final class Builder {
private Optional confidence = Optional.empty();
+ private Optional language = Optional.empty();
+
private Optional speaker = Optional.empty();
private Optional speakerConfidence = Optional.empty();
@@ -146,6 +162,7 @@ public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem
start(other.getStart());
end(other.getEnd());
confidence(other.getConfidence());
+ language(other.getLanguage());
speaker(other.getSpeaker());
speakerConfidence(other.getSpeakerConfidence());
return this;
@@ -195,6 +212,20 @@ public Builder confidence(Float confidence) {
return this;
}
+ /**
+ * BCP-47 language tag of the word's detected language. Only present when language=multi. Can be absent on audio that switches languages.
+ */
+ @JsonSetter(value = "language", nulls = Nulls.SKIP)
+ public Builder language(Optional language) {
+ this.language = language;
+ return this;
+ }
+
+ public Builder language(String language) {
+ this.language = Optional.ofNullable(language);
+ return this;
+ }
+
/**
* The speaker of the word, present when diarization is enabled
*/
@@ -225,7 +256,7 @@ public Builder speakerConfidence(Float speakerConfidence) {
public ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem build() {
return new ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem(
- word, start, end, confidence, speaker, speakerConfidence, additionalProperties);
+ word, start, end, confidence, language, speaker, speakerConfidence, additionalProperties);
}
public Builder additionalProperty(String key, Object value) {
diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItem.java
index dbee3b6..4491358 100644
--- a/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItem.java
+++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItem.java
@@ -31,6 +31,8 @@ public final class ListenV1ResponseResultsUtterancesItem {
private final Optional transcript;
+ private final Optional> languages;
+
private final Optional> words;
private final Optional speaker;
@@ -45,6 +47,7 @@ private ListenV1ResponseResultsUtterancesItem(
Optional confidence,
Optional channel,
Optional transcript,
+ Optional> languages,
Optional> words,
Optional speaker,
Optional id,
@@ -54,6 +57,7 @@ private ListenV1ResponseResultsUtterancesItem(
this.confidence = confidence;
this.channel = channel;
this.transcript = transcript;
+ this.languages = languages;
this.words = words;
this.speaker = speaker;
this.id = id;
@@ -85,6 +89,14 @@ public Optional getTranscript() {
return transcript;
}
+ /**
+ * @return BCP-47 language tags of the languages detected in the utterance, sorted by word count in descending order. Only present when language=multi.
+ */
+ @JsonProperty("languages")
+ public Optional> getLanguages() {
+ return languages;
+ }
+
@JsonProperty("words")
public Optional> getWords() {
return words;
@@ -118,6 +130,7 @@ private boolean equalTo(ListenV1ResponseResultsUtterancesItem other) {
&& confidence.equals(other.confidence)
&& channel.equals(other.channel)
&& transcript.equals(other.transcript)
+ && languages.equals(other.languages)
&& words.equals(other.words)
&& speaker.equals(other.speaker)
&& id.equals(other.id);
@@ -131,6 +144,7 @@ public int hashCode() {
this.confidence,
this.channel,
this.transcript,
+ this.languages,
this.words,
this.speaker,
this.id);
@@ -157,6 +171,8 @@ public static final class Builder {
private Optional transcript = Optional.empty();
+ private Optional> languages = Optional.empty();
+
private Optional> words = Optional.empty();
private Optional speaker = Optional.empty();
@@ -174,6 +190,7 @@ public Builder from(ListenV1ResponseResultsUtterancesItem other) {
confidence(other.getConfidence());
channel(other.getChannel());
transcript(other.getTranscript());
+ languages(other.getLanguages());
words(other.getWords());
speaker(other.getSpeaker());
id(other.getId());
@@ -235,6 +252,20 @@ public Builder transcript(String transcript) {
return this;
}
+ /**
+ * BCP-47 language tags of the languages detected in the utterance, sorted by word count in descending order. Only present when language=multi.
+ */
+ @JsonSetter(value = "languages", nulls = Nulls.SKIP)
+ public Builder languages(Optional> languages) {
+ this.languages = languages;
+ return this;
+ }
+
+ public Builder languages(List languages) {
+ this.languages = Optional.ofNullable(languages);
+ return this;
+ }
+
@JsonSetter(value = "words", nulls = Nulls.SKIP)
public Builder words(Optional> words) {
this.words = words;
@@ -270,7 +301,7 @@ public Builder id(String id) {
public ListenV1ResponseResultsUtterancesItem build() {
return new ListenV1ResponseResultsUtterancesItem(
- start, end, confidence, channel, transcript, words, speaker, id, additionalProperties);
+ start, end, confidence, channel, transcript, languages, words, speaker, id, additionalProperties);
}
public Builder additionalProperty(String key, Object value) {
diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItemWordsItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItemWordsItem.java
index d23ee8f..23fff95 100644
--- a/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItemWordsItem.java
+++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItemWordsItem.java
@@ -28,6 +28,8 @@ public final class ListenV1ResponseResultsUtterancesItemWordsItem {
private final Optional confidence;
+ private final Optional language;
+
private final Optional speaker;
private final Optional speakerConfidence;
@@ -41,6 +43,7 @@ private ListenV1ResponseResultsUtterancesItemWordsItem(
Optional start,
Optional end,
Optional confidence,
+ Optional language,
Optional speaker,
Optional speakerConfidence,
Optional punctuatedWord,
@@ -49,6 +52,7 @@ private ListenV1ResponseResultsUtterancesItemWordsItem(
this.start = start;
this.end = end;
this.confidence = confidence;
+ this.language = language;
this.speaker = speaker;
this.speakerConfidence = speakerConfidence;
this.punctuatedWord = punctuatedWord;
@@ -75,6 +79,14 @@ public Optional getConfidence() {
return confidence;
}
+ /**
+ * @return BCP-47 language tag of the word's detected language. Only present when language=multi. Can be absent on audio that switches languages.
+ */
+ @JsonProperty("language")
+ public Optional getLanguage() {
+ return language;
+ }
+
@JsonProperty("speaker")
public Optional getSpeaker() {
return speaker;
@@ -107,6 +119,7 @@ private boolean equalTo(ListenV1ResponseResultsUtterancesItemWordsItem other) {
&& start.equals(other.start)
&& end.equals(other.end)
&& confidence.equals(other.confidence)
+ && language.equals(other.language)
&& speaker.equals(other.speaker)
&& speakerConfidence.equals(other.speakerConfidence)
&& punctuatedWord.equals(other.punctuatedWord);
@@ -119,6 +132,7 @@ public int hashCode() {
this.start,
this.end,
this.confidence,
+ this.language,
this.speaker,
this.speakerConfidence,
this.punctuatedWord);
@@ -143,6 +157,8 @@ public static final class Builder {
private Optional confidence = Optional.empty();
+ private Optional language = Optional.empty();
+
private Optional speaker = Optional.empty();
private Optional speakerConfidence = Optional.empty();
@@ -159,6 +175,7 @@ public Builder from(ListenV1ResponseResultsUtterancesItemWordsItem other) {
start(other.getStart());
end(other.getEnd());
confidence(other.getConfidence());
+ language(other.getLanguage());
speaker(other.getSpeaker());
speakerConfidence(other.getSpeakerConfidence());
punctuatedWord(other.getPunctuatedWord());
@@ -209,6 +226,20 @@ public Builder confidence(Float confidence) {
return this;
}
+ /**
+ * BCP-47 language tag of the word's detected language. Only present when language=multi. Can be absent on audio that switches languages.
+ */
+ @JsonSetter(value = "language", nulls = Nulls.SKIP)
+ public Builder language(Optional language) {
+ this.language = language;
+ return this;
+ }
+
+ public Builder language(String language) {
+ this.language = Optional.ofNullable(language);
+ return this;
+ }
+
@JsonSetter(value = "speaker", nulls = Nulls.SKIP)
public Builder speaker(Optional speaker) {
this.speaker = speaker;
@@ -244,7 +275,15 @@ public Builder punctuatedWord(String punctuatedWord) {
public ListenV1ResponseResultsUtterancesItemWordsItem build() {
return new ListenV1ResponseResultsUtterancesItemWordsItem(
- word, start, end, confidence, speaker, speakerConfidence, punctuatedWord, additionalProperties);
+ word,
+ start,
+ end,
+ confidence,
+ language,
+ speaker,
+ speakerConfidence,
+ punctuatedWord,
+ additionalProperties);
}
public Builder additionalProperty(String key, Object value) {
diff --git a/src/test/java/com/deepgram/ListenV1ConfigureErrorWebSocketTest.java b/src/test/java/com/deepgram/ListenV1ConfigureErrorWebSocketTest.java
index 3e89b97..7239095 100644
--- a/src/test/java/com/deepgram/ListenV1ConfigureErrorWebSocketTest.java
+++ b/src/test/java/com/deepgram/ListenV1ConfigureErrorWebSocketTest.java
@@ -5,8 +5,11 @@
import com.deepgram.core.Environment;
import com.deepgram.core.ObjectMappers;
import com.deepgram.resources.listen.v1.types.ListenV1Configure;
+import com.deepgram.resources.listen.v1.types.ListenV1ConfigureFailure;
+import com.deepgram.resources.listen.v1.types.ListenV1ConfigureSuccess;
import com.deepgram.resources.listen.v1.types.ListenV1Error;
import com.deepgram.resources.listen.v1.websocket.V1ConnectOptions;
+import com.deepgram.resources.listen.v1.websocket.ListenV1ConfigureFailureException;
import com.deepgram.resources.listen.v1.websocket.ListenV1ErrorException;
import com.deepgram.resources.listen.v1.websocket.V1WebSocketClient;
import com.deepgram.types.ListenV1Model;
@@ -196,4 +199,122 @@ public void onClosing(WebSocket webSocket, int code, String reason) {
ws.disconnect();
}
}
+
+ @Test
+ void dispatchesConfigureFailuresToGenericHandlerWithoutTypedHandler() throws Exception {
+ server.enqueue(new MockResponse().withWebSocketUpgrade(new WebSocketListener() {
+ @Override
+ public void onMessage(WebSocket webSocket, String text) {
+ webSocket.send("{\"type\":\"ConfigureFailure\",\"request_id\":\"req-1\","
+ + "\"code\":\"CONFIGURE_KEYTERMS_NOT_SUPPORTED\","
+ + "\"description\":\"keyterms unavailable\"}");
+ }
+
+ @Override
+ public void onClosing(WebSocket webSocket, int code, String reason) {
+ webSocket.close(code, reason);
+ }
+ }));
+
+ CountDownLatch errorReceived = new CountDownLatch(1);
+ AtomicReference error = new AtomicReference<>();
+ V1WebSocketClient ws = client.listen().v1().v1WebSocket();
+ ws.onError(event -> {
+ error.set(event);
+ errorReceived.countDown();
+ });
+ try {
+ ws.connect(V1ConnectOptions.builder().model(ListenV1Model.NOVA3).build())
+ .get(5, TimeUnit.SECONDS);
+ ws.sendConfigure(ListenV1Configure.builder().build()).get(5, TimeUnit.SECONDS);
+
+ assertThat(errorReceived.await(5, TimeUnit.SECONDS)).isTrue();
+ assertThat(error.get()).isInstanceOf(ListenV1ConfigureFailureException.class);
+ ListenV1ConfigureFailure failure = ((ListenV1ConfigureFailureException) error.get()).getFailure();
+ assertThat(failure.getRequestId()).isEqualTo("req-1");
+ assertThat(failure.getCode().toString()).isEqualTo("CONFIGURE_KEYTERMS_NOT_SUPPORTED");
+ assertThat(failure.getDescription()).isEqualTo("keyterms unavailable");
+ } finally {
+ ws.disconnect();
+ }
+ }
+
+ @Test
+ void dispatchesConfigureSuccessToTypedHandler() throws Exception {
+ server.enqueue(new MockResponse().withWebSocketUpgrade(new WebSocketListener() {
+ @Override
+ public void onMessage(WebSocket webSocket, String text) {
+ webSocket.send("{\"type\":\"ConfigureSuccess\",\"request_id\":\"req-1\","
+ + "\"keyterms\":[\"Deepgram\"]}");
+ }
+
+ @Override
+ public void onClosing(WebSocket webSocket, int code, String reason) {
+ webSocket.close(code, reason);
+ }
+ }));
+
+ CountDownLatch received = new CountDownLatch(1);
+ AtomicReference success = new AtomicReference<>();
+ AtomicInteger genericErrorCount = new AtomicInteger();
+ V1WebSocketClient ws = client.listen().v1().v1WebSocket();
+ ws.onConfigureSuccess(event -> {
+ success.set(event);
+ received.countDown();
+ });
+ ws.onError(event -> genericErrorCount.incrementAndGet());
+ try {
+ ws.connect(V1ConnectOptions.builder().model(ListenV1Model.NOVA3).build())
+ .get(5, TimeUnit.SECONDS);
+ ws.sendConfigure(ListenV1Configure.builder().keyterms(List.of("Deepgram")).build())
+ .get(5, TimeUnit.SECONDS);
+
+ assertThat(received.await(5, TimeUnit.SECONDS)).isTrue();
+ assertThat(success.get().getRequestId()).isEqualTo("req-1");
+ assertThat(success.get().getKeyterms()).contains(List.of("Deepgram"));
+ assertThat(genericErrorCount).hasValue(0);
+ } finally {
+ ws.disconnect();
+ }
+ }
+
+ @Test
+ void dispatchesConfigureFailureToTypedHandler() throws Exception {
+ server.enqueue(new MockResponse().withWebSocketUpgrade(new WebSocketListener() {
+ @Override
+ public void onMessage(WebSocket webSocket, String text) {
+ webSocket.send("{\"type\":\"ConfigureFailure\",\"request_id\":\"req-1\","
+ + "\"code\":\"CONFIGURE_KEYTERMS_NOT_SUPPORTED\","
+ + "\"description\":\"keyterms unavailable\"}");
+ }
+
+ @Override
+ public void onClosing(WebSocket webSocket, int code, String reason) {
+ webSocket.close(code, reason);
+ }
+ }));
+
+ CountDownLatch received = new CountDownLatch(1);
+ AtomicReference failure = new AtomicReference<>();
+ AtomicInteger genericErrorCount = new AtomicInteger();
+ V1WebSocketClient ws = client.listen().v1().v1WebSocket();
+ ws.onConfigureFailure(event -> {
+ failure.set(event);
+ received.countDown();
+ });
+ ws.onError(event -> genericErrorCount.incrementAndGet());
+ try {
+ ws.connect(V1ConnectOptions.builder().model(ListenV1Model.NOVA3).build())
+ .get(5, TimeUnit.SECONDS);
+ ws.sendConfigure(ListenV1Configure.builder().build()).get(5, TimeUnit.SECONDS);
+
+ assertThat(received.await(5, TimeUnit.SECONDS)).isTrue();
+ assertThat(failure.get().getRequestId()).isEqualTo("req-1");
+ assertThat(failure.get().getCode().toString()).isEqualTo("CONFIGURE_KEYTERMS_NOT_SUPPORTED");
+ assertThat(failure.get().getDescription()).isEqualTo("keyterms unavailable");
+ assertThat(genericErrorCount).hasValue(0);
+ } finally {
+ ws.disconnect();
+ }
+ }
}
diff --git a/src/test/java/com/deepgram/ListenV1ConnectWireTest.java b/src/test/java/com/deepgram/ListenV1ConnectWireTest.java
index cac6b5a..88bf917 100644
--- a/src/test/java/com/deepgram/ListenV1ConnectWireTest.java
+++ b/src/test/java/com/deepgram/ListenV1ConnectWireTest.java
@@ -7,6 +7,8 @@
import com.deepgram.types.ListenV1Extra;
import com.deepgram.types.ListenV1Keyterm;
import com.deepgram.types.ListenV1Keywords;
+import com.deepgram.types.ListenV1Language;
+import com.deepgram.types.ListenV1LanguageHint;
import com.deepgram.types.ListenV1Model;
import com.deepgram.types.ListenV1Replace;
import com.deepgram.types.ListenV1Search;
@@ -29,10 +31,10 @@
* {@code listen().v1().v1WebSocket().connect(...)} (GET /v1/listen upgrade).
*
* Guards that every {@code String | List} query param (keyterm, keywords, replace,
- * search, tag, extra) serializes a multi-value list as repeated params ({@code keyterm=a&keyterm=b})
- * rather than a single stringified list ({@code keyterm=[a, b]}), which the server would treat as
- * one nonsense term, while a scalar string stays a single param. Frozen via {@code src/test/} in
- * .fernignore.
+ * search, tag, extra, language_hint) serializes a multi-value list as repeated params ({@code
+ * keyterm=a&keyterm=b}) rather than a single stringified list ({@code keyterm=[a, b]}), which the
+ * server would treat as one nonsense term, while a scalar string stays a single param. Frozen via
+ * {@code src/test/} in .fernignore.
*/
class ListenV1ConnectWireTest {
private MockWebServer server;
@@ -106,6 +108,30 @@ void keywordsListSentAsRepeatedParams() throws Exception {
assertThat(url.queryParameterValues("keywords")).containsExactly("a:2", "b");
}
+ @Test
+ @DisplayName("multiple language hints are sent as repeated params")
+ void languageHintListSentAsRepeatedParams() throws Exception {
+ HttpUrl url = connectAndCaptureUrl(V1ConnectOptions.builder()
+ .model(ListenV1Model.NOVA3)
+ .language(ListenV1Language.of("multi"))
+ .languageHint(ListenV1LanguageHint.of(List.of("en", "es")))
+ .build());
+
+ assertThat(url.queryParameterValues("language_hint")).containsExactly("en", "es");
+ }
+
+ @Test
+ @DisplayName("a single language hint is sent as one param")
+ void languageHintStringSentAsOneParam() throws Exception {
+ HttpUrl url = connectAndCaptureUrl(V1ConnectOptions.builder()
+ .model(ListenV1Model.NOVA3)
+ .language(ListenV1Language.of("multi"))
+ .languageHint(ListenV1LanguageHint.of("en"))
+ .build());
+
+ assertThat(url.queryParameterValues("language_hint")).containsExactly("en");
+ }
+
@Test
@DisplayName("multiple replace terms are sent as repeated params")
void replaceListSentAsRepeatedParams() throws Exception {
diff --git a/src/test/java/com/deepgram/ListenV1LanguageHintRestWireTest.java b/src/test/java/com/deepgram/ListenV1LanguageHintRestWireTest.java
new file mode 100644
index 0000000..0b7e3fc
--- /dev/null
+++ b/src/test/java/com/deepgram/ListenV1LanguageHintRestWireTest.java
@@ -0,0 +1,100 @@
+package com.deepgram;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.deepgram.core.Environment;
+import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl;
+import com.deepgram.resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream;
+import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestModel;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import okhttp3.mockwebserver.MockResponse;
+import okhttp3.mockwebserver.MockWebServer;
+import okhttp3.mockwebserver.RecordedRequest;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class ListenV1LanguageHintRestWireTest {
+ private MockWebServer server;
+ private DeepgramClient client;
+ private AsyncDeepgramClient asyncClient;
+
+ @BeforeEach
+ void setUp() throws Exception {
+ server = new MockWebServer();
+ server.start();
+ String base = server.url("/").toString().replaceAll("/$", "");
+ Environment environment = Environment.custom()
+ .base(base)
+ .production(base)
+ .agent(base)
+ .agentRest(base)
+ .build();
+ client = DeepgramClient.builder().apiKey("test").environment(environment).build();
+ asyncClient = AsyncDeepgramClient.builder().apiKey("test").environment(environment).build();
+ }
+
+ @AfterEach
+ void tearDown() throws Exception {
+ server.shutdown();
+ }
+
+ @Test
+ void sendsRepeatedHintsForEveryUrlAndFileRequestPath() throws Exception {
+ server.enqueue(new MockResponse().setResponseCode(500).setBody("{}"));
+ try {
+ client.listen().v1().media().transcribeUrl(ListenV1RequestUrl.builder()
+ .url("https://example.com/audio.wav")
+ .model(MediaTranscribeRequestModel.NOVA3)
+ .languageHint(List.of("en", "es"))
+ .build());
+ } catch (RuntimeException ignored) {
+ // The response is intentionally an error; this test only captures the outbound URL.
+ }
+ assertLanguageHints(server.takeRequest(5, TimeUnit.SECONDS));
+
+ server.enqueue(new MockResponse().setResponseCode(500).setBody("{}"));
+ try {
+ client.listen().v1().media().transcribeFile(MediaTranscribeRequestOctetStream.builder()
+ .body(new byte[] {1, 2, 3})
+ .model(MediaTranscribeRequestModel.NOVA3)
+ .languageHint(List.of("en", "es"))
+ .build());
+ } catch (RuntimeException ignored) {
+ // The response is intentionally an error; this test only captures the outbound URL.
+ }
+ assertLanguageHints(server.takeRequest(5, TimeUnit.SECONDS));
+
+ server.enqueue(new MockResponse().setResponseCode(500).setBody("{}"));
+ try {
+ asyncClient.listen().v1().media().transcribeUrl(ListenV1RequestUrl.builder()
+ .url("https://example.com/audio.wav")
+ .model(MediaTranscribeRequestModel.NOVA3)
+ .languageHint(List.of("en", "es"))
+ .build())
+ .get(5, TimeUnit.SECONDS);
+ } catch (Exception ignored) {
+ // The response is intentionally an error; this test only captures the outbound URL.
+ }
+ assertLanguageHints(server.takeRequest(5, TimeUnit.SECONDS));
+
+ server.enqueue(new MockResponse().setResponseCode(500).setBody("{}"));
+ try {
+ asyncClient.listen().v1().media().transcribeFile(MediaTranscribeRequestOctetStream.builder()
+ .body(new byte[] {1, 2, 3})
+ .model(MediaTranscribeRequestModel.NOVA3)
+ .languageHint(List.of("en", "es"))
+ .build())
+ .get(5, TimeUnit.SECONDS);
+ } catch (Exception ignored) {
+ // The response is intentionally an error; this test only captures the outbound URL.
+ }
+ assertLanguageHints(server.takeRequest(5, TimeUnit.SECONDS));
+ }
+
+ private void assertLanguageHints(RecordedRequest request) {
+ assertThat(request).isNotNull();
+ assertThat(request.getRequestUrl().queryParameterValues("language_hint")).containsExactly("en", "es");
+ }
+}
diff --git a/src/test/java/com/deepgram/RegenTypesTest.java b/src/test/java/com/deepgram/RegenTypesTest.java
index 554853d..e1f82ac 100644
--- a/src/test/java/com/deepgram/RegenTypesTest.java
+++ b/src/test/java/com/deepgram/RegenTypesTest.java
@@ -13,7 +13,11 @@
import com.deepgram.resources.agent.v1.types.AgentV1ThinkUpdated;
import com.deepgram.resources.agent.v1.types.AgentV1UpdateListenListenProvider;
import com.deepgram.resources.agent.v1.types.AgentV1UserStartedSpeaking;
+import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl;
+import com.deepgram.resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream;
+import com.deepgram.resources.listen.v1.types.ListenV1ResultsChannelAlternativesItem;
import com.deepgram.resources.listen.v1.types.ListenV1ResultsMetadata;
+import com.deepgram.resources.listen.v1.websocket.V1ConnectOptions;
import com.deepgram.resources.listen.v2.types.ListenV2CloseStream;
import com.deepgram.resources.listen.v2.types.ListenV2ForceEndTurn;
import com.deepgram.resources.listen.v2.types.ListenV2TurnInfo;
@@ -29,7 +33,9 @@
import com.deepgram.types.Google;
import com.deepgram.types.GoogleModel;
import com.deepgram.types.GoogleVersion;
+import com.deepgram.types.ListenV1LanguageHint;
import com.deepgram.types.ListenV1ResponseMetadata;
+import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItem;
import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem;
import com.deepgram.types.ListenV2Redact;
import com.deepgram.types.SharedIntents;
@@ -37,6 +43,8 @@
import com.deepgram.types.ThinkSettingsV1FunctionsItem;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
@@ -223,6 +231,52 @@ void reneeConstantSurvives() throws Exception {
}
}
+ @Nested
+ @DisplayName("2026-10-23 multilingual Listen V1 fields")
+ class MultilingualListenV1 {
+
+ @Test
+ void deserializesStreamingAndPreRecordedLanguageMetadata() throws Exception {
+ String json = "{\"transcript\":\"hola\",\"confidence\":0.9,\"languages\":[\"es\"],"
+ + "\"languages_hinted\":[\"en\",\"es\"],\"words\":[]}";
+
+ ListenV1ResultsChannelAlternativesItem streaming =
+ MAPPER.readValue(json, ListenV1ResultsChannelAlternativesItem.class);
+ ListenV1ResponseResultsChannelsItemAlternativesItem prerecorded =
+ MAPPER.readValue(json, ListenV1ResponseResultsChannelsItemAlternativesItem.class);
+
+ assertThat(streaming.getLanguages()).contains(List.of("es"));
+ assertThat(streaming.getLanguagesHinted()).contains(List.of("en", "es"));
+ assertThat(prerecorded.getLanguages()).contains(List.of("es"));
+ assertThat(prerecorded.getLanguagesHinted()).contains(List.of("en", "es"));
+ }
+ }
+
+ @Nested
+ @DisplayName("2026-10-23 Listen V1 builder compatibility")
+ class ListenV1BuilderCompatibility {
+
+ @Test
+ void languageHintMethodsRemainDefaultForExistingBuilderImplementations() throws Exception {
+ assertThat(V1ConnectOptions._FinalStage.class
+ .getMethod("languageHint", Optional.class)
+ .isDefault())
+ .isTrue();
+ assertThat(V1ConnectOptions._FinalStage.class
+ .getMethod("languageHint", ListenV1LanguageHint.class)
+ .isDefault())
+ .isTrue();
+ assertLanguageHintDefaults(ListenV1RequestUrl._FinalStage.class);
+ assertLanguageHintDefaults(MediaTranscribeRequestOctetStream._FinalStage.class);
+ }
+
+ private void assertLanguageHintDefaults(Class> builderStage) throws Exception {
+ assertThat(builderStage.getMethod("languageHint", Optional.class).isDefault()).isTrue();
+ assertThat(builderStage.getMethod("languageHint", List.class).isDefault()).isTrue();
+ assertThat(builderStage.getMethod("languageHint", String.class).isDefault()).isTrue();
+ }
+ }
+
/**
* Coverage for public-surface changes introduced by the 2026-08-11 regeneration. These are
* breaking (documented in {@code docs/Migrating-v0.7-to-v0.8.md}); the tests pin the new typed