Class: Vapi::WorkflowGoogleModel

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model:, temperature: OMIT, max_tokens: OMIT, additional_properties: nil) ⇒ Vapi::WorkflowGoogleModel



28
29
30
31
32
33
34
35
36
# File 'lib/vapi_server_sdk/types/workflow_google_model.rb', line 28

def initialize(model:, temperature: OMIT, max_tokens: OMIT, additional_properties: nil)
  @model = model
  @temperature = temperature if temperature != OMIT
  @max_tokens = max_tokens if max_tokens != OMIT
  @additional_properties = additional_properties
  @_field_set = { "model": model, "temperature": temperature, "maxTokens": max_tokens }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



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

def additional_properties
  @additional_properties
end

#max_tokensFloat (readonly)



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

def max_tokens
  @max_tokens
end

#modelVapi::WorkflowGoogleModelModel (readonly)



10
11
12
# File 'lib/vapi_server_sdk/types/workflow_google_model.rb', line 10

def model
  @model
end

#temperatureFloat (readonly)



12
13
14
# File 'lib/vapi_server_sdk/types/workflow_google_model.rb', line 12

def temperature
  @temperature
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::WorkflowGoogleModel

Deserialize a JSON object to an instance of WorkflowGoogleModel



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/vapi_server_sdk/types/workflow_google_model.rb', line 42

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  model = parsed_json["model"]
  temperature = parsed_json["temperature"]
  max_tokens = parsed_json["maxTokens"]
  new(
    model: model,
    temperature: temperature,
    max_tokens: max_tokens,
    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.


69
70
71
72
73
# File 'lib/vapi_server_sdk/types/workflow_google_model.rb', line 69

def self.validate_raw(obj:)
  obj.model.is_a?(Vapi::WorkflowGoogleModelModel) != false || raise("Passed value for field obj.model 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.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of WorkflowGoogleModel to a JSON object



59
60
61
# File 'lib/vapi_server_sdk/types/workflow_google_model.rb', line 59

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