Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 172b11c

Browse files
committed
Set default value so endUtteranceSilenceThreshold isn't null.
1 parent d6a6165 commit 172b11c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/main/java/com/assemblyai/api/RealtimeTranscriber.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public void connect() {
9191

9292
/**
9393
* Stream binary audio data
94+
*
9495
* @param audio byte array audio data
9596
*/
9697
public void sendAudio(byte[] audio) {
@@ -99,6 +100,7 @@ public void sendAudio(byte[] audio) {
99100

100101
/**
101102
* Stream base64 encoded audio data
103+
*
102104
* @param audio base64 audio data string
103105
*/
104106
public void sendAudio(String audio) {
@@ -144,7 +146,7 @@ public static final class Builder {
144146
private String apiKey;
145147
private Integer sampleRate;
146148
private List<String> wordBoost;
147-
private Optional<Integer> endUtteranceSilenceThreshold;
149+
private Optional<Integer> endUtteranceSilenceThreshold = Optional.empty();
148150
private Consumer<SessionBegins> onSessionBegins;
149151
private Consumer<PartialTranscript> onPartialTranscript;
150152
private Consumer<FinalTranscript> onFinalTranscript;
@@ -154,6 +156,7 @@ public static final class Builder {
154156

155157
/**
156158
* Sets api key
159+
*
157160
* @param apiKey The AssemblyAI API Key
158161
* @return this
159162
*/
@@ -164,6 +167,7 @@ public RealtimeTranscriber.Builder apiKey(String apiKey) {
164167

165168
/**
166169
* Sets sample rate
170+
*
167171
* @param sampleRate The audio sample rate. Defaults to 16_000
168172
* @return this
169173
*/
@@ -174,6 +178,7 @@ public RealtimeTranscriber.Builder sampleRate(int sampleRate) {
174178

175179
/**
176180
* Sets word boost
181+
*
177182
* @param wordBoost An array of words to boost
178183
* @return this
179184
*/
@@ -184,6 +189,7 @@ public RealtimeTranscriber.Builder wordBoost(List<String> wordBoost) {
184189

185190
/**
186191
* Configure the threshold for how long to wait before ending an utterance. Default is 700ms.
192+
*
187193
* @param threshold The duration of the end utterance silence threshold in milliseconds
188194
* @return this
189195
*/
@@ -195,6 +201,7 @@ public RealtimeTranscriber.Builder endUtteranceSilenceThreshold(int threshold) {
195201

196202
/**
197203
* Sets onSessionStart
204+
*
198205
* @param onSessionStart an event handler for the start event. Defaults to a noop.
199206
* @return this
200207
* @deprecated use {@link #onSessionBegins(Consumer)} instead.
@@ -206,6 +213,7 @@ public RealtimeTranscriber.Builder onSessionStart(Consumer<SessionBegins> onSess
206213

207214
/**
208215
* Sets onSessionBegins
216+
*
209217
* @param onSessionBegins an event handler for the start event. Defaults to a noop.
210218
* @return this
211219
*/
@@ -216,6 +224,7 @@ public RealtimeTranscriber.Builder onSessionBegins(Consumer<SessionBegins> onSes
216224

217225
/**
218226
* Sets onPartialTranscript
227+
*
219228
* @param onPartialTranscript an event handler for the partial transcript event. Defaults to a noop.
220229
* @return this
221230
*/
@@ -226,6 +235,7 @@ public RealtimeTranscriber.Builder onPartialTranscript(Consumer<PartialTranscrip
226235

227236
/**
228237
* Sets onPartialTranscript
238+
*
229239
* @param onFinalTranscript an event handler for the final transcript event. Defaults to a noop.
230240
* @return this
231241
*/
@@ -236,6 +246,7 @@ public RealtimeTranscriber.Builder onFinalTranscript(Consumer<FinalTranscript> o
236246

237247
/**
238248
* Sets onTranscript
249+
*
239250
* @param onTranscript an event handler for any transcript event (partial or final). Defaults to a noop.
240251
* @return this
241252
*/
@@ -246,6 +257,7 @@ public RealtimeTranscriber.Builder onTranscript(Consumer<RealtimeTranscript> onT
246257

247258
/**
248259
* Sets onError
260+
*
249261
* @param onError an event handler for an error event. Defaults to a noop.
250262
* @return this
251263
*/
@@ -256,6 +268,7 @@ public RealtimeTranscriber.Builder onError(Consumer<Throwable> onError) {
256268

257269
/**
258270
* Sets onClose
271+
*
259272
* @param onClose an event handler for the closing event. Defaults to a noop.
260273
* @return this
261274
*/

0 commit comments

Comments
 (0)