Class: Vapi::CreateAssistantDtoVoice

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

Overview

These are the options for the assistant’s voice.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(member:, discriminant:) ⇒ Vapi::CreateAssistantDtoVoice

Parameters:

  • member (Object)
  • discriminant (String)


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

def initialize(member:, discriminant:)
  @member = member
  @discriminant = discriminant
end

Instance Attribute Details

#discriminantString (readonly)

Returns:

  • (String)


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

def discriminant
  @discriminant
end

#memberObject (readonly)

Returns:

  • (Object)


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

def member
  @member
end

Class Method Details

._11_labs(member:) ⇒ Vapi::CreateAssistantDtoVoice

Parameters:

Returns:



152
153
154
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 152

def self._11_labs(member:)
  new(member: member, discriminant: "11labs")
end

.azure(member:) ⇒ Vapi::CreateAssistantDtoVoice

Parameters:

Returns:



134
135
136
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 134

def self.azure(member:)
  new(member: member, discriminant: "azure")
end

.cartesia(member:) ⇒ Vapi::CreateAssistantDtoVoice

Parameters:

Returns:



140
141
142
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 140

def self.cartesia(member:)
  new(member: member, discriminant: "cartesia")
end

.deepgram(member:) ⇒ Vapi::CreateAssistantDtoVoice

Parameters:

Returns:



146
147
148
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 146

def self.deepgram(member:)
  new(member: member, discriminant: "deepgram")
end

.from_json(json_object:) ⇒ Vapi::CreateAssistantDtoVoice

Deserialize a JSON object to an instance of CreateAssistantDtoVoice

Parameters:

  • json_object (String)

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 37

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  member = case struct.provider
           when "azure"
             Vapi::AzureVoice.from_json(json_object: json_object)
           when "cartesia"
             Vapi::CartesiaVoice.from_json(json_object: json_object)
           when "deepgram"
             Vapi::DeepgramVoice.from_json(json_object: json_object)
           when "11labs"
             Vapi::ElevenLabsVoice.from_json(json_object: json_object)
           when "lmnt"
             Vapi::LmntVoice.from_json(json_object: json_object)
           when "neets"
             Vapi::NeetsVoice.from_json(json_object: json_object)
           when "openai"
             Vapi::OpenAiVoice.from_json(json_object: json_object)
           when "playht"
             Vapi::PlayHtVoice.from_json(json_object: json_object)
           when "rime-ai"
             Vapi::RimeAiVoice.from_json(json_object: json_object)
           else
             Vapi::AzureVoice.from_json(json_object: json_object)
           end
  new(member: member, discriminant: struct.provider)
end

.lmnt(member:) ⇒ Vapi::CreateAssistantDtoVoice

Parameters:

Returns:



158
159
160
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 158

def self.lmnt(member:)
  new(member: member, discriminant: "lmnt")
end

.neets(member:) ⇒ Vapi::CreateAssistantDtoVoice

Parameters:

Returns:



164
165
166
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 164

def self.neets(member:)
  new(member: member, discriminant: "neets")
end

.openai(member:) ⇒ Vapi::CreateAssistantDtoVoice

Parameters:

Returns:



170
171
172
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 170

def self.openai(member:)
  new(member: member, discriminant: "openai")
end

.playht(member:) ⇒ Vapi::CreateAssistantDtoVoice

Parameters:

Returns:



176
177
178
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 176

def self.playht(member:)
  new(member: member, discriminant: "playht")
end

.rime_ai(member:) ⇒ Vapi::CreateAssistantDtoVoice

Parameters:

Returns:



182
183
184
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 182

def self.rime_ai(member:)
  new(member: member, discriminant: "rime-ai")
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)


99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 99

def self.validate_raw(obj:)
  case obj.provider
  when "azure"
    Vapi::AzureVoice.validate_raw(obj: obj)
  when "cartesia"
    Vapi::CartesiaVoice.validate_raw(obj: obj)
  when "deepgram"
    Vapi::DeepgramVoice.validate_raw(obj: obj)
  when "11labs"
    Vapi::ElevenLabsVoice.validate_raw(obj: obj)
  when "lmnt"
    Vapi::LmntVoice.validate_raw(obj: obj)
  when "neets"
    Vapi::NeetsVoice.validate_raw(obj: obj)
  when "openai"
    Vapi::OpenAiVoice.validate_raw(obj: obj)
  when "playht"
    Vapi::PlayHtVoice.validate_raw(obj: obj)
  when "rime-ai"
    Vapi::RimeAiVoice.validate_raw(obj: obj)
  else
    raise("Passed value matched no type within the union, validation failed.")
  end
end

Instance Method Details

#is_a?(obj) ⇒ Boolean

For Union Types, is_a? functionality is delegated to the wrapped member.

Parameters:

  • obj (Object)

Returns:

  • (Boolean)


128
129
130
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 128

def is_a?(obj)
  @member.is_a?(obj)
end

#kind_of?Object



23
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 23

alias kind_of? is_a?

#to_json(*_args) ⇒ String

For Union Types, to_json functionality is delegated to the wrapped member.

Returns:

  • (String)


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/vapi_server_sdk/types/create_assistant_dto_voice.rb', line 67

def to_json(*_args)
  case @discriminant
  when "azure"
    { **@member.to_json, provider: @discriminant }.to_json
  when "cartesia"
    { **@member.to_json, provider: @discriminant }.to_json
  when "deepgram"
    { **@member.to_json, provider: @discriminant }.to_json
  when "11labs"
    { **@member.to_json, provider: @discriminant }.to_json
  when "lmnt"
    { **@member.to_json, provider: @discriminant }.to_json
  when "neets"
    { **@member.to_json, provider: @discriminant }.to_json
  when "openai"
    { **@member.to_json, provider: @discriminant }.to_json
  when "playht"
    { **@member.to_json, provider: @discriminant }.to_json
  when "rime-ai"
    { **@member.to_json, provider: @discriminant }.to_json
  else
    { "provider": @discriminant, value: @member }.to_json
  end
  @member.to_json
end