Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"cliVersion": "4.107.0",
"cliVersion": "5.44.6",
"generatorName": "fernapi/fern-java-sdk",
"generatorVersion": "4.6.2",
"generatorVersion": "4.10.1",
"generatorConfig": {
"package-prefix": "com.deepgram",
"base-api-exception-class-name": "DeepgramHttpException",
Expand All @@ -11,8 +11,8 @@
},
"enable-wire-tests": true
},
"originGitCommit": "d228f82e93aaa8aa77f978d458cf912f3daaa8c1",
"originGitCommit": "a2c7ddbf260366af00a0e541a7e9ad4de19acabe",
"originGitCommitIsDirty": true,
"invokedBy": "manual",
"sdkVersion": "0.5.0"
"sdkVersion": "0.5.1"
}
5 changes: 1 addition & 4 deletions examples/listen/LiveStreamingV2.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import com.deepgram.DeepgramClient;
import com.deepgram.resources.listen.v2.types.ListenV2CloseStream;
import com.deepgram.resources.listen.v2.types.ListenV2CloseStreamType;
import com.deepgram.resources.listen.v2.types.ListenV2TurnInfoEvent;
import com.deepgram.resources.listen.v2.websocket.V2ConnectOptions;
import com.deepgram.resources.listen.v2.websocket.V2WebSocketClient;
Expand Down Expand Up @@ -78,9 +77,7 @@ public static void main(String[] args) {
// wsClient.sendMedia(audioChunk);

// Close the stream
wsClient.sendCloseStream(ListenV2CloseStream.builder()
.type(ListenV2CloseStreamType.CLOSE_STREAM)
.build());
wsClient.sendCloseStream(ListenV2CloseStream.builder().build());

// Wait for disconnection
closeLatch.await(15, TimeUnit.SECONDS);
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/com/deepgram/core/DateTimeDeserializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalQueries;

Expand Down Expand Up @@ -42,8 +43,15 @@ public OffsetDateTime deserialize(JsonParser parser, DeserializationContext cont
if (token == JsonToken.VALUE_NUMBER_INT) {
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC);
} else {
TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest(
parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from);
String value = parser.getValueAsString();
TemporalAccessor temporal;
try {
temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest(value, OffsetDateTime::from, LocalDateTime::from);
} catch (DateTimeParseException e) {
// Fall back to space-separated format (e.g. "2025-02-15 10:30:00+00:00").
temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest(
value.replace(' ', 'T'), OffsetDateTime::from, LocalDateTime::from);
}

if (temporal.query(TemporalQueries.offset()) == null) {
return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.deepgram.core.DisconnectReason;
import com.deepgram.core.ObjectMappers;
import com.deepgram.core.ReconnectingWebSocketListener;
import com.deepgram.core.RequestOptions;
import com.deepgram.core.WebSocketReadyState;
import com.deepgram.resources.agent.v1.types.AgentV1AgentAudioDone;
import com.deepgram.resources.agent.v1.types.AgentV1AgentStartedSpeaking;
Expand Down Expand Up @@ -141,7 +142,7 @@ public CompletableFuture<Void> connect() {
}
HttpUrl.Builder urlBuilder = parsedUrl.newBuilder();
Request.Builder requestBuilder = new Request.Builder().url(urlBuilder.build());
clientOptions.headers(null).forEach(requestBuilder::addHeader);
clientOptions.headers((RequestOptions) null).forEach(requestBuilder::addHeader);
final Request request = requestBuilder.build();
this.readyState = WebSocketReadyState.CONNECTING;
ReconnectingWebSocketListener.ReconnectOptions reconnectOpts = this.reconnectOptions != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,15 @@ public Optional<Boolean> getDetectLanguage() {
}

/**
* @return Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0
* @return Deprecated: use <code>diarize_model</code> instead. Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0.
*/
@JsonIgnore
public Optional<Boolean> getDiarize() {
return diarize;
}

/**
* @return Select and enable a specific batch diarization model version. If specifying this parameter, you should not set the deprecated <code>diarize=true</code> parameter. Not accepted on streaming requests.
* @return Select and enable a specific diarization model version. Specifying this parameter enables diarization and selects the model — you do not need to also set the deprecated <code>diarize=true</code> parameter. For batch, supported values are <code>latest</code> (currently v2), <code>v1</code>, and <code>v2</code>. For streaming, supported values are <code>latest</code> (currently v1) and <code>v1</code>; <code>v2</code> returns a validation error on streaming requests.
*/
@JsonIgnore
public Optional<MediaTranscribeRequestDiarizeModel> getDiarizeModel() {
Expand Down Expand Up @@ -752,14 +752,14 @@ public interface _FinalStage {
_FinalStage detectLanguage(Boolean detectLanguage);

/**
* <p>Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0</p>
* <p>Deprecated: use <code>diarize_model</code> instead. Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0.</p>
*/
_FinalStage diarize(Optional<Boolean> diarize);

_FinalStage diarize(Boolean diarize);

/**
* <p>Select and enable a specific batch diarization model version. If specifying this parameter, you should not set the deprecated <code>diarize=true</code> parameter. Not accepted on streaming requests.</p>
* <p>Select and enable a specific diarization model version. Specifying this parameter enables diarization and selects the model — you do not need to also set the deprecated <code>diarize=true</code> parameter. For batch, supported values are <code>latest</code> (currently v2), <code>v1</code>, and <code>v2</code>. For streaming, supported values are <code>latest</code> (currently v1) and <code>v1</code>; <code>v2</code> returns a validation error on streaming requests.</p>
*/
_FinalStage diarizeModel(Optional<MediaTranscribeRequestDiarizeModel> diarizeModel);

Expand Down Expand Up @@ -1359,7 +1359,7 @@ public _FinalStage dictation(Optional<Boolean> dictation) {
}

/**
* <p>Select and enable a specific batch diarization model version. If specifying this parameter, you should not set the deprecated <code>diarize=true</code> parameter. Not accepted on streaming requests.</p>
* <p>Select and enable a specific diarization model version. Specifying this parameter enables diarization and selects the model — you do not need to also set the deprecated <code>diarize=true</code> parameter. For batch, supported values are <code>latest</code> (currently v2), <code>v1</code>, and <code>v2</code>. For streaming, supported values are <code>latest</code> (currently v1) and <code>v1</code>; <code>v2</code> returns a validation error on streaming requests.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
Expand All @@ -1369,7 +1369,7 @@ public _FinalStage diarizeModel(MediaTranscribeRequestDiarizeModel diarizeModel)
}

/**
* <p>Select and enable a specific batch diarization model version. If specifying this parameter, you should not set the deprecated <code>diarize=true</code> parameter. Not accepted on streaming requests.</p>
* <p>Select and enable a specific diarization model version. Specifying this parameter enables diarization and selects the model — you do not need to also set the deprecated <code>diarize=true</code> parameter. For batch, supported values are <code>latest</code> (currently v2), <code>v1</code>, and <code>v2</code>. For streaming, supported values are <code>latest</code> (currently v1) and <code>v1</code>; <code>v2</code> returns a validation error on streaming requests.</p>
*/
@java.lang.Override
@JsonSetter(value = "diarize_model", nulls = Nulls.SKIP)
Expand All @@ -1379,7 +1379,7 @@ public _FinalStage diarizeModel(Optional<MediaTranscribeRequestDiarizeModel> dia
}

/**
* <p>Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0</p>
* <p>Deprecated: use <code>diarize_model</code> instead. Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
Expand All @@ -1389,7 +1389,7 @@ public _FinalStage diarize(Boolean diarize) {
}

/**
* <p>Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0</p>
* <p>Deprecated: use <code>diarize_model</code> instead. Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0.</p>
*/
@java.lang.Override
@JsonSetter(value = "diarize", nulls = Nulls.SKIP)
Expand Down
Loading
Loading