Class: Vapi::CreateAssistantDtoModel

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/create_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::CreateAssistantDtoModel

Parameters:

  • member (Object)
  • discriminant (String)


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

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

Instance Attribute Details

#discriminantString (readonly)

Returns:

  • (String)


21
22
23
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 21

def discriminant
  @discriminant
end

#memberObject (readonly)

Returns:

  • (Object)


19
20
21
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 19

def member
  @member
end

Class Method Details

.anthropic(member:) ⇒ Vapi::CreateAssistantDtoModel

Parameters:

Returns:



147
148
149
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 147

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

.anyscale(member:) ⇒ Vapi::CreateAssistantDtoModel

Parameters:

Returns:



141
142
143
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 141

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

.custom_llm(member:) ⇒ Vapi::CreateAssistantDtoModel

Parameters:

Returns:



153
154
155
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 153

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

.deepinfra(member:) ⇒ Vapi::CreateAssistantDtoModel

Parameters:

Returns:



159
160
161
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 159

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

.from_json(json_object:) ⇒ Vapi::CreateAssistantDtoModel

Deserialize a JSON object to an instance of CreateAssistantDtoModel

Parameters:

  • json_object (String)

Returns:



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
63
64
65
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 38

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::CreateAssistantDtoModel

Parameters:

Returns:



165
166
167
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 165

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

.openai(member:) ⇒ Vapi::CreateAssistantDtoModel

Parameters:

Returns:



171
172
173
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 171

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

.openrouter(member:) ⇒ Vapi::CreateAssistantDtoModel

Parameters:

Returns:



177
178
179
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 177

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

.perplexity_ai(member:) ⇒ Vapi::CreateAssistantDtoModel

Parameters:

Returns:



183
184
185
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 183

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

.together_ai(member:) ⇒ Vapi::CreateAssistantDtoModel

Parameters:

Returns:



189
190
191
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 189

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)


104
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
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 104

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::CreateAssistantDtoModel

Parameters:

Returns:



195
196
197
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 195

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)


135
136
137
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 135

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

#kind_of?Object



24
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 24

alias kind_of? is_a?

#to_json(*_args) ⇒ String

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

Returns:

  • (String)


70
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
# File 'lib/vapi_server_sdk/types/create_assistant_dto_model.rb', line 70

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