Class: Vapi::AnthropicThinkingConfig

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, budget_tokens:, additional_properties: nil) ⇒ Vapi::AnthropicThinkingConfig

Parameters:

  • type (String)
  • budget_tokens (Float)

    The maximum number of tokens to allocate for thinking. Must be between 1024 and 100000 tokens.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



26
27
28
29
30
31
# File 'lib/vapi_server_sdk/types/anthropic_thinking_config.rb', line 26

def initialize(type:, budget_tokens:, additional_properties: nil)
  @type = type
  @budget_tokens = budget_tokens
  @additional_properties = additional_properties
  @_field_set = { "type": type, "budgetTokens": budget_tokens }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



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

def additional_properties
  @additional_properties
end

#budget_tokensFloat (readonly)

Returns The maximum number of tokens to allocate for thinking. Must be between 1024 and 100000 tokens.

Returns:

  • (Float)

    The maximum number of tokens to allocate for thinking. Must be between 1024 and 100000 tokens.



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

def budget_tokens
  @budget_tokens
end

#typeString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/vapi_server_sdk/types/anthropic_thinking_config.rb', line 9

def type
  @type
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::AnthropicThinkingConfig

Deserialize a JSON object to an instance of AnthropicThinkingConfig

Parameters:

  • json_object (String)

Returns:



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/vapi_server_sdk/types/anthropic_thinking_config.rb', line 37

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  type = parsed_json["type"]
  budget_tokens = parsed_json["budgetTokens"]
  new(
    type: type,
    budget_tokens: budget_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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


62
63
64
65
# File 'lib/vapi_server_sdk/types/anthropic_thinking_config.rb', line 62

def self.validate_raw(obj:)
  obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.budget_tokens.is_a?(Float) != false || raise("Passed value for field obj.budget_tokens is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AnthropicThinkingConfig to a JSON object

Returns:

  • (String)


52
53
54
# File 'lib/vapi_server_sdk/types/anthropic_thinking_config.rb', line 52

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