Class: Vapi::AssemblyAiTranscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/assembly_ai_transcriber.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(language: OMIT, realtime_url: OMIT, word_boost: OMIT, end_utterance_silence_threshold: OMIT, disable_partial_transcripts: OMIT, additional_properties: nil) ⇒ Vapi::AssemblyAiTranscriber

Parameters:

  • language (String) (defaults to: OMIT) —

    This is the language that will be set for the transcription.

  • realtime_url (String) (defaults to: OMIT) —

    The WebSocket URL that the transcriber connects to.

  • word_boost (Array<String>) (defaults to: OMIT) —

    Add up to 2500 characters of custom vocabulary.

  • end_utterance_silence_threshold (Float) (defaults to: OMIT) —

    The duration of the end utterance silence threshold in milliseconds.

  • disable_partial_transcripts (Boolean) (defaults to: OMIT) —

    Disable partial transcripts. Set to true to not receive partial transcripts. Defaults to false.

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 35

def initialize(language: OMIT, realtime_url: OMIT, word_boost: OMIT, end_utterance_silence_threshold: OMIT,
               disable_partial_transcripts: OMIT, additional_properties: nil)
  @language = language if language != OMIT
  @realtime_url = realtime_url if realtime_url != OMIT
  @word_boost = word_boost if word_boost != OMIT
  @end_utterance_silence_threshold = end_utterance_silence_threshold if end_utterance_silence_threshold != OMIT
  @disable_partial_transcripts = disable_partial_transcripts if disable_partial_transcripts != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "language": language,
    "realtimeUrl": realtime_url,
    "wordBoost": word_boost,
    "endUtteranceSilenceThreshold": end_utterance_silence_threshold,
    "disablePartialTranscripts": disable_partial_transcripts
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



20
21
22
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 20

def additional_properties
  @additional_properties
end

#disable_partial_transcripts ⇒ Boolean (readonly)

Returns Disable partial transcripts. Set to true to not receive partial transcripts. Defaults to false.

Returns:

  • (Boolean) —

    Disable partial transcripts. Set to true to not receive partial transcripts. Defaults to false.



18
19
20
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 18

def disable_partial_transcripts
  @disable_partial_transcripts
end

#end_utterance_silence_threshold ⇒ Float (readonly)

Returns The duration of the end utterance silence threshold in milliseconds.

Returns:

  • (Float) —

    The duration of the end utterance silence threshold in milliseconds.



15
16
17
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 15

def end_utterance_silence_threshold
  @end_utterance_silence_threshold
end

#language ⇒ String (readonly)

Returns This is the language that will be set for the transcription.

Returns:

  • (String) —

    This is the language that will be set for the transcription.



9
10
11
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 9

def language
  @language
end

#realtime_url ⇒ String (readonly)

Returns The WebSocket URL that the transcriber connects to.

Returns:

  • (String) —

    The WebSocket URL that the transcriber connects to.



11
12
13
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 11

def realtime_url
  @realtime_url
end

#word_boost ⇒ Array<String> (readonly)

Returns Add up to 2500 characters of custom vocabulary.

Returns:

  • (Array<String>) —

    Add up to 2500 characters of custom vocabulary.



13
14
15
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 13

def word_boost
  @word_boost
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::AssemblyAiTranscriber

Deserialize a JSON object to an instance of AssemblyAiTranscriber

Parameters:

  • json_object (String)

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 58

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  language = parsed_json["language"]
  realtime_url = parsed_json["realtimeUrl"]
  word_boost = parsed_json["wordBoost"]
  end_utterance_silence_threshold = parsed_json["endUtteranceSilenceThreshold"]
  disable_partial_transcripts = parsed_json["disablePartialTranscripts"]
  new(
    language: language,
    realtime_url: realtime_url,
    word_boost: word_boost,
    end_utterance_silence_threshold: end_utterance_silence_threshold,
    disable_partial_transcripts: disable_partial_transcripts,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


89
90
91
92
93
94
95
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 89

def self.validate_raw(obj:)
  obj.language&.is_a?(String) != false || raise("Passed value for field obj.language is not the expected type, validation failed.")
  obj.realtime_url&.is_a?(String) != false || raise("Passed value for field obj.realtime_url is not the expected type, validation failed.")
  obj.word_boost&.is_a?(Array) != false || raise("Passed value for field obj.word_boost is not the expected type, validation failed.")
  obj.end_utterance_silence_threshold&.is_a?(Float) != false || raise("Passed value for field obj.end_utterance_silence_threshold is not the expected type, validation failed.")
  obj.disable_partial_transcripts&.is_a?(Boolean) != false || raise("Passed value for field obj.disable_partial_transcripts is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AssemblyAiTranscriber to a JSON object

Returns:

  • (String)


79
80
81
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 79

def to_json(*_args)
  @_field_set&.to_json
end