Class: Vapi::HumeVoice

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/hume_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, model: OMIT, is_custom_hume_voice: OMIT, chunk_plan: OMIT, description: OMIT, fallback_plan: OMIT, additional_properties: nil) ⇒ Vapi::HumeVoice

Parameters:

  • caching_enabled (Boolean) (defaults to: OMIT)

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

  • model (String) (defaults to: OMIT)

    This is the model that will be used.

  • voice_id (String)

    The ID of the particular voice you want to use.

  • is_custom_hume_voice (Boolean) (defaults to: OMIT)

    Indicates whether the chosen voice is a preset Hume AI voice or a custom voice.

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

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

  • description (String) (defaults to: OMIT)

    Natural language instructions describing how the synthesized speech should sound, including but not limited to tone, intonation, pacing, and accent (e.g., ‘a soft, gentle voice with a strong British accent’). If a Voice is specified in the request, this description serves as acting instructions. If no Voice is specified, a new voice is generated based on this description.

  • fallback_plan (Vapi::FallbackPlan) (defaults to: OMIT)

    This is the plan for voice provider fallbacks in the event that the primary voice provider fails.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

def initialize(voice_id:, caching_enabled: OMIT, model: OMIT, is_custom_hume_voice: OMIT, chunk_plan: OMIT,
               description: OMIT, fallback_plan: OMIT, additional_properties: nil)
  @caching_enabled = caching_enabled if caching_enabled != OMIT
  @model = model if model != OMIT
  @voice_id = voice_id
  @is_custom_hume_voice = is_custom_hume_voice if is_custom_hume_voice != OMIT
  @chunk_plan = chunk_plan if chunk_plan != OMIT
  @description = description if description != OMIT
  @fallback_plan = fallback_plan if fallback_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "cachingEnabled": caching_enabled,
    "model": model,
    "voiceId": voice_id,
    "isCustomHumeVoice": is_custom_hume_voice,
    "chunkPlan": chunk_plan,
    "description": description,
    "fallbackPlan": fallback_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



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

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.



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

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.



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

def chunk_plan
  @chunk_plan
end

#descriptionString (readonly)

Returns Natural language instructions describing how the synthesized speech should sound, including but not limited to tone, intonation, pacing, and accent (e.g., ‘a soft, gentle voice with a strong British accent’). If a Voice is specified in the request, this description serves as acting instructions. If no Voice is specified, a new voice is generated based on this description.

Returns:

  • (String)

    Natural language instructions describing how the synthesized speech should sound, including but not limited to tone, intonation, pacing, and accent (e.g., ‘a soft, gentle voice with a strong British accent’). If a Voice is specified in the request, this description serves as acting instructions. If no Voice is specified, a new voice is generated based on this description.



27
28
29
# File 'lib/vapi_server_sdk/types/hume_voice.rb', line 27

def description
  @description
end

#fallback_planVapi::FallbackPlan (readonly)

Returns This is the plan for voice provider fallbacks in the event that the primary voice provider fails.

Returns:

  • (Vapi::FallbackPlan)

    This is the plan for voice provider fallbacks in the event that the primary voice provider fails.



30
31
32
# File 'lib/vapi_server_sdk/types/hume_voice.rb', line 30

def fallback_plan
  @fallback_plan
end

#is_custom_hume_voiceBoolean (readonly)

Returns Indicates whether the chosen voice is a preset Hume AI voice or a custom voice.

Returns:

  • (Boolean)

    Indicates whether the chosen voice is a preset Hume AI voice or a custom voice.



17
18
19
# File 'lib/vapi_server_sdk/types/hume_voice.rb', line 17

def is_custom_hume_voice
  @is_custom_hume_voice
end

#modelString (readonly)

Returns This is the model that will be used.

Returns:

  • (String)

    This is the model that will be used.



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

def model
  @model
end

#voice_idString (readonly)

Returns The ID of the particular voice you want to use.

Returns:

  • (String)

    The ID of the particular voice you want to use.



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

def voice_id
  @voice_id
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::HumeVoice

Deserialize a JSON object to an instance of HumeVoice

Parameters:

  • json_object (String)

Returns:



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
108
109
110
111
112
# File 'lib/vapi_server_sdk/types/hume_voice.rb', line 82

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"]
  model = parsed_json["model"]
  voice_id = parsed_json["voiceId"]
  is_custom_hume_voice = parsed_json["isCustomHumeVoice"]
  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
  description = parsed_json["description"]
  if parsed_json["fallbackPlan"].nil?
    fallback_plan = nil
  else
    fallback_plan = parsed_json["fallbackPlan"].to_json
    fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan)
  end
  new(
    caching_enabled: caching_enabled,
    model: model,
    voice_id: voice_id,
    is_custom_hume_voice: is_custom_hume_voice,
    chunk_plan: chunk_plan,
    description: description,
    fallback_plan: fallback_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)


127
128
129
130
131
132
133
134
135
# File 'lib/vapi_server_sdk/types/hume_voice.rb', line 127

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.")
  obj.model&.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.voice_id.is_a?(String) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.")
  obj.is_custom_hume_voice&.is_a?(Boolean) != false || raise("Passed value for field obj.is_custom_hume_voice is not the expected type, validation failed.")
  obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan)
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of HumeVoice to a JSON object

Returns:

  • (String)


117
118
119
# File 'lib/vapi_server_sdk/types/hume_voice.rb', line 117

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