Class: Vapi::Assistants::UpdateAssistantDtoModel

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

Overview

These are the options for the assistant’s LLM.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(member:, discriminant:) ⇒ Vapi::Assistants::UpdateAssistantDtoModel

Parameters:

  • member (Object)
  • discriminant (String)


30
31
32
33
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 30

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

Instance Attribute Details

#discriminantString (readonly)

Returns:

  • (String)


22
23
24
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 22

def discriminant
  @discriminant
end

#memberObject (readonly)

Returns:

  • (Object)


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

def member
  @member
end

Class Method Details

.anthropic(member:) ⇒ Vapi::Assistants::UpdateAssistantDtoModel



148
149
150
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 148

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

.anyscale(member:) ⇒ Vapi::Assistants::UpdateAssistantDtoModel



142
143
144
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 142

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

.custom_llm(member:) ⇒ Vapi::Assistants::UpdateAssistantDtoModel



154
155
156
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 154

def self.custom_llm(member:)
  new(member: member, discriminant: "custom-llm")
end

.deepinfra(member:) ⇒ Vapi::Assistants::UpdateAssistantDtoModel



160
161
162
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 160

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

.from_json(json_object:) ⇒ Vapi::Assistants::UpdateAssistantDtoModel

Deserialize a JSON object to an instance of UpdateAssistantDtoModel

Parameters:

  • json_object (String)

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 39

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  member = case struct.provider
           when "anyscale"
             Vapi::AnyscaleModel.from_json(json_object: json_object)
           when "anthropic"
             Vapi::AnthropicModel.from_json(json_object: json_object)
           when "custom-llm"
             Vapi::CustomLlmModel.from_json(json_object: json_object)
           when "deepinfra"
             Vapi::DeepInfraModel.from_json(json_object: json_object)
           when "groq"
             Vapi::GroqModel.from_json(json_object: json_object)
           when "openai"
             Vapi::OpenAiModel.from_json(json_object: json_object)
           when "openrouter"
             Vapi::OpenRouterModel.from_json(json_object: json_object)
           when "perplexity-ai"
             Vapi::PerplexityAiModel.from_json(json_object: json_object)
           when "together-ai"
             Vapi::TogetherAiModel.from_json(json_object: json_object)
           when "vapi"
             Vapi::VapiModel.from_json(json_object: json_object)
           else
             Vapi::AnyscaleModel.from_json(json_object: json_object)
           end
  new(member: member, discriminant: struct.provider)
end

.groq(member:) ⇒ Vapi::Assistants::UpdateAssistantDtoModel



166
167
168
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 166

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

.openai(member:) ⇒ Vapi::Assistants::UpdateAssistantDtoModel



172
173
174
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 172

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

.openrouter(member:) ⇒ Vapi::Assistants::UpdateAssistantDtoModel



178
179
180
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 178

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

.perplexity_ai(member:) ⇒ Vapi::Assistants::UpdateAssistantDtoModel



184
185
186
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 184

def self.perplexity_ai(member:)
  new(member: member, discriminant: "perplexity-ai")
end

.together_ai(member:) ⇒ Vapi::Assistants::UpdateAssistantDtoModel



190
191
192
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 190

def self.together_ai(member:)
  new(member: member, discriminant: "together-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)


105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 105

def self.validate_raw(obj:)
  case obj.provider
  when "anyscale"
    Vapi::AnyscaleModel.validate_raw(obj: obj)
  when "anthropic"
    Vapi::AnthropicModel.validate_raw(obj: obj)
  when "custom-llm"
    Vapi::CustomLlmModel.validate_raw(obj: obj)
  when "deepinfra"
    Vapi::DeepInfraModel.validate_raw(obj: obj)
  when "groq"
    Vapi::GroqModel.validate_raw(obj: obj)
  when "openai"
    Vapi::OpenAiModel.validate_raw(obj: obj)
  when "openrouter"
    Vapi::OpenRouterModel.validate_raw(obj: obj)
  when "perplexity-ai"
    Vapi::PerplexityAiModel.validate_raw(obj: obj)
  when "together-ai"
    Vapi::TogetherAiModel.validate_raw(obj: obj)
  when "vapi"
    Vapi::VapiModel.validate_raw(obj: obj)
  else
    raise("Passed value matched no type within the union, validation failed.")
  end
end

.vapi(member:) ⇒ Vapi::Assistants::UpdateAssistantDtoModel



196
197
198
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 196

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


136
137
138
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 136

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

#kind_of?Object



25
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 25

alias kind_of? is_a?

#to_json(*_args) ⇒ String

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

Returns:

  • (String)


71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb', line 71

def to_json(*_args)
  case @discriminant
  when "anyscale"
    { **@member.to_json, provider: @discriminant }.to_json
  when "anthropic"
    { **@member.to_json, provider: @discriminant }.to_json
  when "custom-llm"
    { **@member.to_json, provider: @discriminant }.to_json
  when "deepinfra"
    { **@member.to_json, provider: @discriminant }.to_json
  when "groq"
    { **@member.to_json, provider: @discriminant }.to_json
  when "openai"
    { **@member.to_json, provider: @discriminant }.to_json
  when "openrouter"
    { **@member.to_json, provider: @discriminant }.to_json
  when "perplexity-ai"
    { **@member.to_json, provider: @discriminant }.to_json
  when "together-ai"
    { **@member.to_json, provider: @discriminant }.to_json
  when "vapi"
    { **@member.to_json, provider: @discriminant }.to_json
  else
    { "provider": @discriminant, value: @member }.to_json
  end
  @member.to_json
end