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
Oracle model supported language codes are locale specific.
-
#model_domain ⇒ String
Model Domain.
-
#model_type ⇒ String
Select a model to use for generating transcriptions.
-
#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 Currently supported only for Oracle model.
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
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 266 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_type = attributes[:'modelType'] if attributes[:'modelType'] self.model_type = "ORACLE" if model_type.nil? && !attributes.key?(:'modelType') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :modelType and :model_type' if attributes.key?(:'modelType') && attributes.key?(:'model_type') self.model_type = attributes[:'model_type'] if attributes[:'model_type'] self.model_type = "ORACLE" if model_type.nil? && !attributes.key?(:'modelType') && !attributes.key?(:'model_type') # 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. Currently supported only for Oracle model.
200 201 202 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 200 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. Currently supported only for Oracle model.
52 53 54 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 52 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
Oracle model supported language codes are locale specific. Locale value as per given in [datatracker.ietf.org/doc/html/rfc5646] - en-US: English - United States (default) - 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 Whisper model supported language codes are locale agnostic - auto: Auto-detect language - af: Afrikaans - am: Amharic - ar: Arabic - as: Assamese - az: Azerbaijani - ba: Bashkir - be: Belarusian - bg: Bulgarian - bn: Bengali - bo: Tibetan - br: Breton - bs: Bosnian - ca: Catalan - cs: Czech - cy: Welsh - da: Danish - de: German - el: Greek - en: English (default) - es: Spanish - et: Estonian - eu: Basque - fa: Persian - fi: Finnish - fo: Faroese - fr: French - gl: Galician - gu: Gujarati - ha: Hausa - haw: Hawaiian - he: Hebrew - hi: Hindi - hr: Croatian - ht: Haitian Creole - hu: Hungarian - hy: Armenian - id: Indonesian - is: Icelandic - it: Italian - ja: Japanese - jv: Javanese - ka: Georgian - kk: Kazakh - km: Khmer - kn: Kannada - ko: Korean - la: Latin - lb: Luxembourgish - ln: Lingala - lo: Lao - lt: Lithuanian - lv: Latvian - mg: Malagasy - mi: Maori - mk: Macedonian - ml: Malayalam - mn: Mongolian - mr: Marathi - ms: Malay - mt: Maltese - my: Burmese - ne: Nepali - nl: Dutch - nn: Norwegian Nynorsk - no: Norwegian - oc: Occitan - pa: Punjabi - pl: Polish - ps: Pashto - pt: Portuguese - ro: Romanian - ru: Russian - sa: Sanskrit - sd: Sindhi - si: Sinhala - sk: Slovak - sl: Slovenian - sn: Shona - so: Somali - sq: Albanian - sr: Serbian - su: Sundanese - sv: Swedish - sw: Swahili - ta: Tamil - te: Telugu - tg: Tajik - th: Thai - tk: Turkmen - tl: Tagalog - tr: Turkish - tt: Tatar - uk: Ukrainian - ur: Urdu - uz: Uzbek - vi: Vietnamese - yi: Yiddish - yo: Yoruba - zh: Chinese
187 188 189 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 187 def language_code @language_code end |
#model_domain ⇒ String
Model Domain.
69 70 71 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 69 def model_domain @model_domain end |
#model_type ⇒ String
Select a model to use for generating transcriptions. Currently supported models are: - ORACLE - WHISPER
65 66 67 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 65 def model_type @model_type end |
#partial_silence_threshold_in_ms ⇒ Integer
Silence threshold for Realtime Speech partial results in milliseconds. Currently supported only for Oracle model.
46 47 48 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 46 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 Spoken punctuation is currently supported only for the Oracle model in the Medical domain.
209 210 211 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 209 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. Currently supported only for Oracle model.
194 195 196 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 194 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 Currently supported only for Oracle model.
58 59 60 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 58 def stabilize_partial_results @stabilize_partial_results end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 212 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_type': :'modelType', '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.
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 231 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_type': :'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.
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 370 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_type == other.model_type && 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
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 410 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
390 391 392 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 390 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
399 400 401 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 399 def hash [encoding, is_ack_enabled, partial_silence_threshold_in_ms, final_silence_threshold_in_ms, stabilize_partial_results, model_type, model_domain, language_code, should_ignore_invalid_customizations, customizations, punctuation].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
443 444 445 446 447 448 449 450 451 452 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 443 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
437 438 439 |
# File 'lib/oci/ai_speech/models/realtime_parameters.rb', line 437 def to_s to_hash.to_s end |