Class: OCI::AiSpeech::Models::RealtimeParameters
- Inherits:
-
Object
- Object
- OCI::AiSpeech::Models::RealtimeParameters
- Defined in:
- lib/oci/ai_speech/models/realtime_parameters.rb
Overview
Parameters to be sent to the realtime speech service over a websocket connection.
Constant Summary collapse
- STABILIZE_PARTIAL_RESULTS_ENUM =
[ STABILIZE_PARTIAL_RESULTS_NONE = 'NONE'.freeze, STABILIZE_PARTIAL_RESULTS_LOW = 'LOW'.freeze, STABILIZE_PARTIAL_RESULTS_MEDIUM = 'MEDIUM'.freeze, STABILIZE_PARTIAL_RESULTS_HIGH = 'HIGH'.freeze ].freeze
- MODEL_DOMAIN_ENUM =
[ MODEL_DOMAIN_GENERIC = 'GENERIC'.freeze, MODEL_DOMAIN_MEDICAL = 'MEDICAL'.freeze ].freeze
- PUNCTUATION_ENUM =
[ PUNCTUATION_NONE = 'NONE'.freeze, PUNCTUATION_SPOKEN = 'SPOKEN'.freeze, PUNCTUATION_AUTO = 'AUTO'.freeze ].freeze
Instance Attribute Summary collapse
-
#customizations ⇒ Array<OCI::AiSpeech::Models::CustomizationInference>
Array of customization objects.
-
#encoding ⇒ String
Audio encoding to use - audio/raw;rate=16000 - audio/raw;rate=8000 - audio/raw;rate=8000;codec=mulaw - audio/raw;rate=8000;codec=alaw.
-
#final_silence_threshold_in_ms ⇒ Integer
Silence threshold for Realtime Speech final results in milliseconds.
-
#is_ack_enabled ⇒ BOOLEAN
Toggle for ack messages.
-
#language_code ⇒ String
Locale value as per given in [datatracker.ietf.org/doc/html/rfc5646].
-
#model_domain ⇒ String
Model Domain.
-
#partial_silence_threshold_in_ms ⇒ Integer
Silence threshold for Realtime Speech partial results in milliseconds.
-
#punctuation ⇒ String
Configure punctuations in the generated transcriptions.
-
#should_ignore_invalid_customizations ⇒ BOOLEAN
If set to true, the service will not fail connection attempt if it encounters any issues that prevent the loading of all specified user customizations.
-
#stabilize_partial_results ⇒ String
When enabled sets the amount of confidence required for latest tokens before returning them as part of a new partial result.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ RealtimeParameters
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ RealtimeParameters
Initializes the object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 143 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.encoding = attributes[:'encoding'] if attributes[:'encoding'] self.encoding = "audio/raw;rate=16000" if encoding.nil? && !attributes.key?(:'encoding') # rubocop:disable Style/StringLiterals self.is_ack_enabled = attributes[:'isAckEnabled'] unless attributes[:'isAckEnabled'].nil? self.is_ack_enabled = false if is_ack_enabled.nil? && !attributes.key?(:'isAckEnabled') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :isAckEnabled and :is_ack_enabled' if attributes.key?(:'isAckEnabled') && attributes.key?(:'is_ack_enabled') self.is_ack_enabled = attributes[:'is_ack_enabled'] unless attributes[:'is_ack_enabled'].nil? self.is_ack_enabled = false if is_ack_enabled.nil? && !attributes.key?(:'isAckEnabled') && !attributes.key?(:'is_ack_enabled') # rubocop:disable Style/StringLiterals self.partial_silence_threshold_in_ms = attributes[:'partialSilenceThresholdInMs'] if attributes[:'partialSilenceThresholdInMs'] raise 'You cannot provide both :partialSilenceThresholdInMs and :partial_silence_threshold_in_ms' if attributes.key?(:'partialSilenceThresholdInMs') && attributes.key?(:'partial_silence_threshold_in_ms') self.partial_silence_threshold_in_ms = attributes[:'partial_silence_threshold_in_ms'] if attributes[:'partial_silence_threshold_in_ms'] self.final_silence_threshold_in_ms = attributes[:'finalSilenceThresholdInMs'] if attributes[:'finalSilenceThresholdInMs'] raise 'You cannot provide both :finalSilenceThresholdInMs and :final_silence_threshold_in_ms' if attributes.key?(:'finalSilenceThresholdInMs') && attributes.key?(:'final_silence_threshold_in_ms') self.final_silence_threshold_in_ms = attributes[:'final_silence_threshold_in_ms'] if attributes[:'final_silence_threshold_in_ms'] self.stabilize_partial_results = attributes[:'stabilizePartialResults'] if attributes[:'stabilizePartialResults'] self.stabilize_partial_results = "NONE" if stabilize_partial_results.nil? && !attributes.key?(:'stabilizePartialResults') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :stabilizePartialResults and :stabilize_partial_results' if attributes.key?(:'stabilizePartialResults') && attributes.key?(:'stabilize_partial_results') self.stabilize_partial_results = attributes[:'stabilize_partial_results'] if attributes[:'stabilize_partial_results'] self.stabilize_partial_results = "NONE" if stabilize_partial_results.nil? && !attributes.key?(:'stabilizePartialResults') && !attributes.key?(:'stabilize_partial_results') # rubocop:disable Style/StringLiterals self.model_domain = attributes[:'modelDomain'] if attributes[:'modelDomain'] self.model_domain = "GENERIC" if model_domain.nil? && !attributes.key?(:'modelDomain') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :modelDomain and :model_domain' if attributes.key?(:'modelDomain') && attributes.key?(:'model_domain') self.model_domain = attributes[:'model_domain'] if attributes[:'model_domain'] self.model_domain = "GENERIC" if model_domain.nil? && !attributes.key?(:'modelDomain') && !attributes.key?(:'model_domain') # rubocop:disable Style/StringLiterals self.language_code = attributes[:'languageCode'] if attributes[:'languageCode'] raise 'You cannot provide both :languageCode and :language_code' if attributes.key?(:'languageCode') && attributes.key?(:'language_code') self.language_code = attributes[:'language_code'] if attributes[:'language_code'] self.should_ignore_invalid_customizations = attributes[:'shouldIgnoreInvalidCustomizations'] unless attributes[:'shouldIgnoreInvalidCustomizations'].nil? self.should_ignore_invalid_customizations = false if should_ignore_invalid_customizations.nil? && !attributes.key?(:'shouldIgnoreInvalidCustomizations') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :shouldIgnoreInvalidCustomizations and :should_ignore_invalid_customizations' if attributes.key?(:'shouldIgnoreInvalidCustomizations') && attributes.key?(:'should_ignore_invalid_customizations') self.should_ignore_invalid_customizations = attributes[:'should_ignore_invalid_customizations'] unless attributes[:'should_ignore_invalid_customizations'].nil? self.should_ignore_invalid_customizations = false if should_ignore_invalid_customizations.nil? && !attributes.key?(:'shouldIgnoreInvalidCustomizations') && !attributes.key?(:'should_ignore_invalid_customizations') # rubocop:disable Style/StringLiterals self.customizations = attributes[:'customizations'] if attributes[:'customizations'] self.punctuation = attributes[:'punctuation'] if attributes[:'punctuation'] self.punctuation = "NONE" if punctuation.nil? && !attributes.key?(:'punctuation') # rubocop:disable Style/StringLiterals end |
Instance Attribute Details
#customizations ⇒ Array<OCI::AiSpeech::Models::CustomizationInference>
Array of customization objects.
81 82 83 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 81 def customizations @customizations end |
#encoding ⇒ String
Audio encoding to use - audio/raw;rate=16000 - audio/raw;rate=8000 - audio/raw;rate=8000;codec=mulaw - audio/raw;rate=8000;codec=alaw
36 37 38 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 36 def encoding @encoding end |
#final_silence_threshold_in_ms ⇒ Integer
Silence threshold for Realtime Speech final results in milliseconds.
48 49 50 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 48 def final_silence_threshold_in_ms @final_silence_threshold_in_ms end |
#is_ack_enabled ⇒ BOOLEAN
Toggle for ack messages.
40 41 42 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 40 def is_ack_enabled @is_ack_enabled end |
#language_code ⇒ String
Locale value as per given in [datatracker.ietf.org/doc/html/rfc5646]. - en-US: English - United States - es-ES: Spanish - Spain - pt-BR: Portuguese - Brazil - en-GB: English - Great Britain - en-AU: English - Australia - en-IN: English - India - hi-IN: Hindi - India - fr-FR: French - France - de-DE: German - Germany - it-IT: Italian - Italy
71 72 73 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 71 def language_code @language_code end |
#model_domain ⇒ String
Model Domain.
56 57 58 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 56 def model_domain @model_domain end |
#partial_silence_threshold_in_ms ⇒ Integer
Silence threshold for Realtime Speech partial results in milliseconds.
44 45 46 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 44 def partial_silence_threshold_in_ms @partial_silence_threshold_in_ms end |
#punctuation ⇒ String
Configure punctuations in the generated transcriptions. Disabled by default. - NONE: No punctuation in the transcription response - SPOKEN: Punctuations in response only when verbally spoken - AUTO: Automatic punctuation in the response, spoken punctuations are disabled
89 90 91 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 89 def punctuation @punctuation end |
#should_ignore_invalid_customizations ⇒ BOOLEAN
If set to true, the service will not fail connection attempt if it encounters any issues that prevent the loading of all specified user customizations. Any invalid customizations will simply be ignored and connection will continue being established with the default base model and any remaining valid customizations. If set to false, if the service is unable to load any of the specified customizations, an error detailing why will be returned and the session will end.
77 78 79 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 77 def should_ignore_invalid_customizations @should_ignore_invalid_customizations end |
#stabilize_partial_results ⇒ String
When enabled sets the amount of confidence required for latest tokens before returning them as part of a new partial result
52 53 54 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 52 def stabilize_partial_results @stabilize_partial_results end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 92 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'encoding': :'encoding', 'is_ack_enabled': :'isAckEnabled', 'partial_silence_threshold_in_ms': :'partialSilenceThresholdInMs', 'final_silence_threshold_in_ms': :'finalSilenceThresholdInMs', 'stabilize_partial_results': :'stabilizePartialResults', 'model_domain': :'modelDomain', 'language_code': :'languageCode', 'should_ignore_invalid_customizations': :'shouldIgnoreInvalidCustomizations', 'customizations': :'customizations', 'punctuation': :'punctuation' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 110 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'encoding': :'String', 'is_ack_enabled': :'BOOLEAN', 'partial_silence_threshold_in_ms': :'Integer', 'final_silence_threshold_in_ms': :'Integer', 'stabilize_partial_results': :'String', 'model_domain': :'String', 'language_code': :'String', 'should_ignore_invalid_customizations': :'BOOLEAN', 'customizations': :'Array<OCI::AiSpeech::Models::CustomizationInference>', 'punctuation': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 239 def ==(other) return true if equal?(other) self.class == other.class && encoding == other.encoding && is_ack_enabled == other.is_ack_enabled && partial_silence_threshold_in_ms == other.partial_silence_threshold_in_ms && final_silence_threshold_in_ms == other.final_silence_threshold_in_ms && stabilize_partial_results == other.stabilize_partial_results && model_domain == other.model_domain && language_code == other.language_code && should_ignore_invalid_customizations == other.should_ignore_invalid_customizations && customizations == other.customizations && punctuation == other.punctuation end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 278 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(other) ⇒ Boolean
258 259 260 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 258 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
267 268 269 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 267 def hash [encoding, is_ack_enabled, partial_silence_threshold_in_ms, final_silence_threshold_in_ms, stabilize_partial_results, model_domain, language_code, should_ignore_invalid_customizations, customizations, punctuation].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
311 312 313 314 315 316 317 318 319 320 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 311 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
305 306 307 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 305 def to_s to_hash.to_s end |