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 ;
2324
2425/**
@@ -132,7 +133,8 @@ public interface Model {
132133 String ZH_CN_NARROWBANDMODEL = "zh-CN_NarrowbandModel" ;
133134 }
134135
135- private InputStream audio ;
136+ private transient InputStream audio ;
137+ @ SerializedName ("content-type" )
136138 private String contentType ;
137139 private String model ;
138140 private String languageCustomizationId ;
@@ -153,6 +155,9 @@ public interface Model {
153155 private String grammarName ;
154156 private Boolean redaction ;
155157 private Boolean audioMetrics ;
158+ private Boolean interimResults ;
159+ private Boolean processingMetrics ;
160+ private Float processingMetricsInterval ;
156161
157162 /**
158163 * Builder.
@@ -179,6 +184,9 @@ public static class Builder {
179184 private String grammarName ;
180185 private Boolean redaction ;
181186 private Boolean audioMetrics ;
187+ private Boolean interimResults ;
188+ private Boolean processingMetrics ;
189+ private Float processingMetricsInterval ;
182190
183191 private Builder (RecognizeOptions recognizeOptions ) {
184192 this .audio = recognizeOptions .audio ;
@@ -202,6 +210,9 @@ private Builder(RecognizeOptions recognizeOptions) {
202210 this .grammarName = recognizeOptions .grammarName ;
203211 this .redaction = recognizeOptions .redaction ;
204212 this .audioMetrics = recognizeOptions .audioMetrics ;
213+ this .interimResults = recognizeOptions .interimResults ;
214+ this .processingMetrics = recognizeOptions .processingMetrics ;
215+ this .processingMetricsInterval = recognizeOptions .processingMetricsInterval ;
205216 }
206217
207218 /**
@@ -488,6 +499,45 @@ public Builder audio(File audio) throws FileNotFoundException {
488499 this .audio = new FileInputStream (audio );
489500 return this ;
490501 }
502+
503+ /**
504+ * Set the interimResults.
505+ *
506+ * NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
507+ *
508+ * @param interimResults the interimResults
509+ * @return the interimResults
510+ */
511+ public Builder interimResults (Boolean interimResults ) {
512+ this .interimResults = interimResults ;
513+ return this ;
514+ }
515+
516+ /**
517+ * Set the processingMetrics.
518+ *
519+ * NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
520+ *
521+ * @param processingMetrics the processingMetrics
522+ * @return the processingMetrics
523+ */
524+ public Builder processingMetrics (Boolean processingMetrics ) {
525+ this .processingMetrics = processingMetrics ;
526+ return this ;
527+ }
528+
529+ /**
530+ * Set the processingMetricsInterval.
531+ *
532+ * NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
533+ *
534+ * @param processingMetricsInterval the processingMetricsInterval
535+ * @return the processingMetricsInterval
536+ */
537+ public Builder processingMetricsInterval (Float processingMetricsInterval ) {
538+ this .processingMetricsInterval = processingMetricsInterval ;
539+ return this ;
540+ }
491541 }
492542
493543 private RecognizeOptions (Builder builder ) {
@@ -514,6 +564,9 @@ private RecognizeOptions(Builder builder) {
514564 grammarName = builder .grammarName ;
515565 redaction = builder .redaction ;
516566 audioMetrics = builder .audioMetrics ;
567+ interimResults = builder .interimResults ;
568+ processingMetrics = builder .processingMetrics ;
569+ processingMetricsInterval = builder .processingMetricsInterval ;
517570 }
518571
519572 /**
@@ -840,4 +893,56 @@ public Boolean redaction() {
840893 public Boolean audioMetrics () {
841894 return audioMetrics ;
842895 }
896+
897+ /**
898+ * Gets the interimResults.
899+ *
900+ * If `true`, the service returns interim results as a stream of `SpeechRecognitionResults` objects. By default,
901+ * the service returns a single `SpeechRecognitionResults` object with final results only.
902+ *
903+ * NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
904+ *
905+ * @return the interimResults
906+ */
907+ public Boolean interimResults () {
908+ return interimResults ;
909+ }
910+
911+ /**
912+ * Gets the processingMetrics.
913+ *
914+ * If `true`, requests processing metrics about the service's transcription of the input audio. The service returns
915+ * processing metrics at the interval specified by the `processing_metrics_interval` parameter. It also returns
916+ * processing metrics for transcription events, for example, for final and interim results. By default, the service
917+ * returns no processing metrics.
918+ *
919+ * NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
920+ *
921+ * @return the processingMetrics
922+ */
923+ public Boolean processingMetrics () {
924+ return processingMetrics ;
925+ }
926+
927+ /**
928+ * Gets the processingMetricsInterval.
929+ *
930+ * Specifies the interval in real wall-clock seconds at which the service is to return processing metrics. The
931+ * parameter is ignored unless the `processing_metrics` parameter is set to `true`.
932+ *
933+ * The parameter accepts a minimum value of 0.1 seconds. The level of precision is not restricted, so you can
934+ * specify values such as 0.25 and 0.125.
935+ *
936+ * The service does not impose a maximum value. If you want to receive processing metrics only for transcription
937+ * events instead of at periodic intervals, set the value to a large number. If the value is larger than the
938+ * duration of the audio, the service returns processing metrics only for transcription events.
939+ *
940+ * NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
941+ *
942+ * @return the processingMetricsInterval
943+ */
944+ public Float processingMetricsInterval () {
945+ return processingMetricsInterval ;
946+ }
947+
843948}
0 commit comments