Class: Vapi::WorkflowAnthropicModel

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/vapi_server_sdk/types/workflow_anthropic_model.rb', line 36

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

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



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

def additional_properties
  @additional_properties
end

#max_tokensFloat (readonly)



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

def max_tokens
  @max_tokens
end

#modelVapi::WorkflowAnthropicModelModel (readonly)



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

def model
  @model
end

#temperatureFloat (readonly)



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

def temperature
  @temperature
end

#thinkingVapi::AnthropicThinkingConfig (readonly)



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

def thinking
  @thinking
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::WorkflowAnthropicModel

Deserialize a JSON object to an instance of WorkflowAnthropicModel



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  model = parsed_json["model"]
  if parsed_json["thinking"].nil?
    thinking = nil
  else
    thinking = parsed_json["thinking"].to_json
    thinking = Vapi::AnthropicThinkingConfig.from_json(json_object: thinking)
  end
  temperature = parsed_json["temperature"]
  max_tokens = parsed_json["maxTokens"]
  new(
    model: model,
    thinking: thinking,
    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.


90
91
92
93
94
95
# File 'lib/vapi_server_sdk/types/workflow_anthropic_model.rb', line 90

def self.validate_raw(obj:)
  obj.model.is_a?(Vapi::WorkflowAnthropicModelModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.thinking.nil? || Vapi::AnthropicThinkingConfig.validate_raw(obj: obj.thinking)
  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 WorkflowAnthropicModel to a JSON object



80
81
82
# File 'lib/vapi_server_sdk/types/workflow_anthropic_model.rb', line 80

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