1919import java .util .ArrayList ;
2020import java .util .List ;
2121
22+ import com .google .gson .annotations .SerializedName ;
2223import com .ibm .cloud .sdk .core .service .model .GenericModel ;
2324import com .ibm .cloud .sdk .core .util .Validator ;
2425
@@ -113,7 +114,7 @@ public interface ContentType {
113114 String AUDIO_WEBM_CODECS_VORBIS = "audio/webm;codecs=vorbis" ;
114115 }
115116
116- private InputStream audio ;
117+ private transient InputStream audio ;
117118 private String model ;
118119 private String languageCustomizationId ;
119120 private String acousticCustomizationId ;
@@ -133,7 +134,11 @@ public interface ContentType {
133134 private String grammarName ;
134135 private Boolean redaction ;
135136 private Boolean audioMetrics ;
137+ @ SerializedName ("content-type" )
136138 private String contentType ;
139+ private Boolean interimResults ;
140+ private Boolean processingMetrics ;
141+ private Float processingMetricsInterval ;
137142
138143 /**
139144 * Builder.
@@ -160,6 +165,9 @@ public static class Builder {
160165 private Boolean redaction ;
161166 private Boolean audioMetrics ;
162167 private String contentType ;
168+ private Boolean interimResults ;
169+ private Boolean processingMetrics ;
170+ private Float processingMetricsInterval ;
163171
164172 private Builder (RecognizeOptions recognizeOptions ) {
165173 this .audio = recognizeOptions .audio ;
@@ -183,6 +191,9 @@ private Builder(RecognizeOptions recognizeOptions) {
183191 this .redaction = recognizeOptions .redaction ;
184192 this .audioMetrics = recognizeOptions .audioMetrics ;
185193 this .contentType = recognizeOptions .contentType ;
194+ this .interimResults = recognizeOptions .interimResults ;
195+ this .processingMetrics = recognizeOptions .processingMetrics ;
196+ this .processingMetricsInterval = recognizeOptions .processingMetricsInterval ;
186197 }
187198
188199 /**
@@ -468,6 +479,45 @@ public Builder audio(File audio) throws FileNotFoundException {
468479 this .audio = new FileInputStream (audio );
469480 return this ;
470481 }
482+
483+ /**
484+ * Set the interimResults.
485+ *
486+ * NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
487+ *
488+ * @param interimResults the interimResults
489+ * @return the interimResults
490+ */
491+ public Builder interimResults (Boolean interimResults ) {
492+ this .interimResults = interimResults ;
493+ return this ;
494+ }
495+
496+ /**
497+ * Set the processingMetrics.
498+ *
499+ * NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
500+ *
501+ * @param processingMetrics the processingMetrics
502+ * @return the processingMetrics
503+ */
504+ public Builder processingMetrics (Boolean processingMetrics ) {
505+ this .processingMetrics = processingMetrics ;
506+ return this ;
507+ }
508+
509+ /**
510+ * Set the processingMetricsInterval.
511+ *
512+ * NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
513+ *
514+ * @param processingMetricsInterval the processingMetricsInterval
515+ * @return the processingMetricsInterval
516+ */
517+ public Builder processingMetricsInterval (Float processingMetricsInterval ) {
518+ this .processingMetricsInterval = processingMetricsInterval ;
519+ return this ;
520+ }
471521 }
472522
473523 private RecognizeOptions (Builder builder ) {
@@ -493,6 +543,9 @@ private RecognizeOptions(Builder builder) {
493543 redaction = builder .redaction ;
494544 audioMetrics = builder .audioMetrics ;
495545 contentType = builder .contentType ;
546+ interimResults = builder .interimResults ;
547+ processingMetrics = builder .processingMetrics ;
548+ processingMetricsInterval = builder .processingMetricsInterval ;
496549 }
497550
498551 /**
@@ -819,4 +872,55 @@ public Boolean audioMetrics() {
819872 public String contentType () {
820873 return contentType ;
821874 }
875+
876+ /**
877+ * Gets the interimResults.
878+ *
879+ * If `true`, the service returns interim results as a stream of `SpeechRecognitionResults` objects. By default,
880+ * the service returns a single `SpeechRecognitionResults` object with final results only.
881+ *
882+ * NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
883+ *
884+ * @return the interimResults
885+ */
886+ public Boolean interimResults () {
887+ return interimResults ;
888+ }
889+
890+ /**
891+ * Gets the processingMetrics.
892+ *
893+ * If `true`, requests processing metrics about the service's transcription of the input audio. The service returns
894+ * processing metrics at the interval specified by the `processing_metrics_interval` parameter. It also returns
895+ * processing metrics for transcription events, for example, for final and interim results. By default, the service
896+ * returns no processing metrics.
897+ *
898+ * NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
899+ *
900+ * @return the processingMetrics
901+ */
902+ public Boolean processingMetrics () {
903+ return processingMetrics ;
904+ }
905+
906+ /**
907+ * Gets the processingMetricsInterval.
908+ *
909+ * Specifies the interval in real wall-clock seconds at which the service is to return processing metrics. The
910+ * parameter is ignored unless the `processing_metrics` parameter is set to `true`.
911+ *
912+ * The parameter accepts a minimum value of 0.1 seconds. The level of precision is not restricted, so you can
913+ * specify values such as 0.25 and 0.125.
914+ *
915+ * The service does not impose a maximum value. If you want to receive processing metrics only for transcription
916+ * events instead of at periodic intervals, set the value to a large number. If the value is larger than the
917+ * duration of the audio, the service returns processing metrics only for transcription events.
918+ *
919+ * NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
920+ *
921+ * @return the processingMetricsInterval
922+ */
923+ public Float processingMetricsInterval () {
924+ return processingMetricsInterval ;
925+ }
822926}
0 commit comments