Class: Vapi::FallbackPlayHtVoice

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(voice_id:, caching_enabled: OMIT, speed: OMIT, temperature: OMIT, emotion: OMIT, voice_guidance: OMIT, style_guidance: OMIT, text_guidance: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil) ⇒ Vapi::FallbackPlayHtVoice

Parameters:

  • caching_enabled (Boolean) (defaults to: OMIT)

    This is the flag to toggle voice caching for the assistant.

  • voice_id (Vapi::FallbackPlayHtVoiceId)

    This is the provider-specific ID that will be used.

  • speed (Float) (defaults to: OMIT)

    This is the speed multiplier that will be used.

  • temperature (Float) (defaults to: OMIT)

    A floating point number between 0, exclusive, and 2, inclusive. If equal to null or not provided, the model’s default temperature will be used. The temperature parameter controls variance. Lower temperatures result in more predictable results, higher temperatures allow each run to vary more, so the voice may sound less like the baseline voice.

  • emotion (Vapi::FallbackPlayHtVoiceEmotion) (defaults to: OMIT)

    An emotion to be applied to the speech.

  • voice_guidance (Float) (defaults to: OMIT)

    A number between 1 and 6. Use lower numbers to reduce how unique your chosen voice will be compared to other voices.

  • style_guidance (Float) (defaults to: OMIT)

    A number between 1 and 30. Use lower numbers to to reduce how strong your chosen emotion will be. Higher numbers will create a very emotional performance.

  • text_guidance (Float) (defaults to: OMIT)

    A number between 1 and 2. This number influences how closely the generated speech adheres to the input text. Use lower values to create more fluid speech, but with a higher chance of deviating from the input text. Higher numbers will make the generated speech more accurate to the input text, ensuring that the words spoken align closely with the provided text.

  • model (Vapi::FallbackPlayHtVoiceModel) (defaults to: OMIT)

    Playht voice model/engine to use.

  • language (Vapi::FallbackPlayHtVoiceLanguage) (defaults to: OMIT)

    The language to use for the speech.

  • chunk_plan (Vapi::ChunkPlan) (defaults to: OMIT)

    This is the plan for chunking the model output before it is sent to the voice provider.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 78

def initialize(voice_id:, caching_enabled: OMIT, speed: OMIT, temperature: OMIT, emotion: OMIT,
               voice_guidance: OMIT, style_guidance: OMIT, text_guidance: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil)
  @caching_enabled = caching_enabled if caching_enabled != OMIT
  @voice_id = voice_id
  @speed = speed if speed != OMIT
  @temperature = temperature if temperature != OMIT
  @emotion = emotion if emotion != OMIT
  @voice_guidance = voice_guidance if voice_guidance != OMIT
  @style_guidance = style_guidance if style_guidance != OMIT
  @text_guidance = text_guidance if text_guidance != OMIT
  @model = model if model != OMIT
  @language = language if language != OMIT
  @chunk_plan = chunk_plan if chunk_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "cachingEnabled": caching_enabled,
    "voiceId": voice_id,
    "speed": speed,
    "temperature": temperature,
    "emotion": emotion,
    "voiceGuidance": voice_guidance,
    "styleGuidance": style_guidance,
    "textGuidance": text_guidance,
    "model": model,
    "language": language,
    "chunkPlan": chunk_plan
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



47
48
49
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 47

def additional_properties
  @additional_properties
end

#caching_enabledBoolean (readonly)

Returns This is the flag to toggle voice caching for the assistant.

Returns:

  • (Boolean)

    This is the flag to toggle voice caching for the assistant.



14
15
16
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 14

def caching_enabled
  @caching_enabled
end

#chunk_planVapi::ChunkPlan (readonly)

Returns This is the plan for chunking the model output before it is sent to the voice provider.

Returns:

  • (Vapi::ChunkPlan)

    This is the plan for chunking the model output before it is sent to the voice provider.



45
46
47
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 45

def chunk_plan
  @chunk_plan
end

#emotionVapi::FallbackPlayHtVoiceEmotion (readonly)

Returns An emotion to be applied to the speech.

Returns:



26
27
28
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 26

def emotion
  @emotion
end

#languageVapi::FallbackPlayHtVoiceLanguage (readonly)

Returns The language to use for the speech.

Returns:



42
43
44
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 42

def language
  @language
end

#modelVapi::FallbackPlayHtVoiceModel (readonly)

Returns Playht voice model/engine to use.

Returns:



40
41
42
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 40

def model
  @model
end

#speedFloat (readonly)

Returns This is the speed multiplier that will be used.

Returns:

  • (Float)

    This is the speed multiplier that will be used.



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

def speed
  @speed
end

#style_guidanceFloat (readonly)

Returns A number between 1 and 30. Use lower numbers to to reduce how strong your chosen emotion will be. Higher numbers will create a very emotional performance.

Returns:

  • (Float)

    A number between 1 and 30. Use lower numbers to to reduce how strong your chosen emotion will be. Higher numbers will create a very emotional performance.



32
33
34
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 32

def style_guidance
  @style_guidance
end

#temperatureFloat (readonly)

Returns A floating point number between 0, exclusive, and 2, inclusive. If equal to null or not provided, the model’s default temperature will be used. The temperature parameter controls variance. Lower temperatures result in more predictable results, higher temperatures allow each run to vary more, so the voice may sound less like the baseline voice.

Returns:

  • (Float)

    A floating point number between 0, exclusive, and 2, inclusive. If equal to null or not provided, the model’s default temperature will be used. The temperature parameter controls variance. Lower temperatures result in more predictable results, higher temperatures allow each run to vary more, so the voice may sound less like the baseline voice.



24
25
26
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 24

def temperature
  @temperature
end

#text_guidanceFloat (readonly)

Returns A number between 1 and 2. This number influences how closely the generated speech adheres to the input text. Use lower values to create more fluid speech, but with a higher chance of deviating from the input text. Higher numbers will make the generated speech more accurate to the input text, ensuring that the words spoken align closely with the provided text.

Returns:

  • (Float)

    A number between 1 and 2. This number influences how closely the generated speech adheres to the input text. Use lower values to create more fluid speech, but with a higher chance of deviating from the input text. Higher numbers will make the generated speech more accurate to the input text, ensuring that the words spoken align closely with the provided text.



38
39
40
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 38

def text_guidance
  @text_guidance
end

#voice_guidanceFloat (readonly)

Returns A number between 1 and 6. Use lower numbers to reduce how unique your chosen voice will be compared to other voices.

Returns:

  • (Float)

    A number between 1 and 6. Use lower numbers to reduce how unique your chosen voice will be compared to other voices.



29
30
31
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 29

def voice_guidance
  @voice_guidance
end

#voice_idVapi::FallbackPlayHtVoiceId (readonly)

Returns This is the provider-specific ID that will be used.

Returns:



16
17
18
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 16

def voice_id
  @voice_id
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::FallbackPlayHtVoice

Deserialize a JSON object to an instance of FallbackPlayHtVoice

Parameters:

  • json_object (String)

Returns:



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 113

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  caching_enabled = parsed_json["cachingEnabled"]
  if parsed_json["voiceId"].nil?
    voice_id = nil
  else
    voice_id = parsed_json["voiceId"].to_json
    voice_id = Vapi::FallbackPlayHtVoiceId.from_json(json_object: voice_id)
  end
  speed = parsed_json["speed"]
  temperature = parsed_json["temperature"]
  emotion = parsed_json["emotion"]
  voice_guidance = parsed_json["voiceGuidance"]
  style_guidance = parsed_json["styleGuidance"]
  text_guidance = parsed_json["textGuidance"]
  model = parsed_json["model"]
  language = parsed_json["language"]
  if parsed_json["chunkPlan"].nil?
    chunk_plan = nil
  else
    chunk_plan = parsed_json["chunkPlan"].to_json
    chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan)
  end
  new(
    caching_enabled: caching_enabled,
    voice_id: voice_id,
    speed: speed,
    temperature: temperature,
    emotion: emotion,
    voice_guidance: voice_guidance,
    style_guidance: style_guidance,
    text_guidance: text_guidance,
    model: model,
    language: language,
    chunk_plan: chunk_plan,
    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)


166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 166

def self.validate_raw(obj:)
  obj.caching_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.caching_enabled is not the expected type, validation failed.")
  Vapi::FallbackPlayHtVoiceId.validate_raw(obj: obj.voice_id)
  obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.")
  obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.")
  obj.emotion&.is_a?(Vapi::FallbackPlayHtVoiceEmotion) != false || raise("Passed value for field obj.emotion is not the expected type, validation failed.")
  obj.voice_guidance&.is_a?(Float) != false || raise("Passed value for field obj.voice_guidance is not the expected type, validation failed.")
  obj.style_guidance&.is_a?(Float) != false || raise("Passed value for field obj.style_guidance is not the expected type, validation failed.")
  obj.text_guidance&.is_a?(Float) != false || raise("Passed value for field obj.text_guidance is not the expected type, validation failed.")
  obj.model&.is_a?(Vapi::FallbackPlayHtVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.language&.is_a?(Vapi::FallbackPlayHtVoiceLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.")
  obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of FallbackPlayHtVoice to a JSON object

Returns:

  • (String)


156
157
158
# File 'lib/vapi_server_sdk/types/fallback_play_ht_voice.rb', line 156

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