Class: Vapi::VoicemailDetectionCost
- Inherits:
-
Object
- Object
- Vapi::VoicemailDetectionCost
- Defined in:
- lib/vapi_server_sdk/types/voicemail_detection_cost.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#completion_audio_tokens ⇒ Float
readonly
This is the number of completion audio tokens used in the voicemail detection.
-
#completion_text_tokens ⇒ Float
readonly
This is the number of completion text tokens used in the voicemail detection.
-
#cost ⇒ Float
readonly
This is the cost of the component in USD.
-
#model ⇒ Hash{String => Object}
readonly
This is the model that was used to perform the analysis.
-
#prompt_audio_tokens ⇒ Float
readonly
This is the number of prompt audio tokens used in the voicemail detection.
-
#prompt_text_tokens ⇒ Float
readonly
This is the number of prompt text tokens used in the voicemail detection.
-
#provider ⇒ Vapi::VoicemailDetectionCostProvider
readonly
This is the provider that was used to detect the voicemail.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::VoicemailDetectionCost
Deserialize a JSON object to an instance of VoicemailDetectionCost.
-
.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.
Instance Method Summary collapse
- #initialize(model:, provider:, prompt_text_tokens:, prompt_audio_tokens:, completion_text_tokens:, completion_audio_tokens:, cost:, additional_properties: nil) ⇒ Vapi::VoicemailDetectionCost constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of VoicemailDetectionCost to a JSON object.
Constructor Details
#initialize(model:, provider:, prompt_text_tokens:, prompt_audio_tokens:, completion_text_tokens:, completion_audio_tokens:, cost:, additional_properties: nil) ⇒ Vapi::VoicemailDetectionCost
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/vapi_server_sdk/types/voicemail_detection_cost.rb', line 40 def initialize(model:, provider:, prompt_text_tokens:, prompt_audio_tokens:, completion_text_tokens:, completion_audio_tokens:, cost:, additional_properties: nil) @model = model @provider = provider @prompt_text_tokens = prompt_text_tokens @prompt_audio_tokens = prompt_audio_tokens @completion_text_tokens = completion_text_tokens @completion_audio_tokens = completion_audio_tokens @cost = cost @additional_properties = additional_properties @_field_set = { "model": model, "provider": provider, "promptTextTokens": prompt_text_tokens, "promptAudioTokens": prompt_audio_tokens, "completionTextTokens": completion_text_tokens, "completionAudioTokens": completion_audio_tokens, "cost": cost } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
24 25 26 |
# File 'lib/vapi_server_sdk/types/voicemail_detection_cost.rb', line 24 def additional_properties @additional_properties end |
#completion_audio_tokens ⇒ Float (readonly)
Returns This is the number of completion audio tokens used in the voicemail detection.
20 21 22 |
# File 'lib/vapi_server_sdk/types/voicemail_detection_cost.rb', line 20 def completion_audio_tokens @completion_audio_tokens end |
#completion_text_tokens ⇒ Float (readonly)
Returns This is the number of completion text tokens used in the voicemail detection.
18 19 20 |
# File 'lib/vapi_server_sdk/types/voicemail_detection_cost.rb', line 18 def completion_text_tokens @completion_text_tokens end |
#cost ⇒ Float (readonly)
Returns This is the cost of the component in USD.
22 23 24 |
# File 'lib/vapi_server_sdk/types/voicemail_detection_cost.rb', line 22 def cost @cost end |
#model ⇒ Hash{String => Object} (readonly)
Returns This is the model that was used to perform the analysis.
10 11 12 |
# File 'lib/vapi_server_sdk/types/voicemail_detection_cost.rb', line 10 def model @model end |
#prompt_audio_tokens ⇒ Float (readonly)
Returns This is the number of prompt audio tokens used in the voicemail detection.
16 17 18 |
# File 'lib/vapi_server_sdk/types/voicemail_detection_cost.rb', line 16 def prompt_audio_tokens @prompt_audio_tokens end |
#prompt_text_tokens ⇒ Float (readonly)
Returns This is the number of prompt text tokens used in the voicemail detection.
14 15 16 |
# File 'lib/vapi_server_sdk/types/voicemail_detection_cost.rb', line 14 def prompt_text_tokens @prompt_text_tokens end |
#provider ⇒ Vapi::VoicemailDetectionCostProvider (readonly)
Returns This is the provider that was used to detect the voicemail.
12 13 14 |
# File 'lib/vapi_server_sdk/types/voicemail_detection_cost.rb', line 12 def provider @provider end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::VoicemailDetectionCost
Deserialize a JSON object to an instance of VoicemailDetectionCost
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/vapi_server_sdk/types/voicemail_detection_cost.rb', line 65 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) model = parsed_json["model"] provider = parsed_json["provider"] prompt_text_tokens = parsed_json["promptTextTokens"] prompt_audio_tokens = parsed_json["promptAudioTokens"] completion_text_tokens = parsed_json["completionTextTokens"] completion_audio_tokens = parsed_json["completionAudioTokens"] cost = parsed_json["cost"] new( model: model, provider: provider, prompt_text_tokens: prompt_text_tokens, prompt_audio_tokens: prompt_audio_tokens, completion_text_tokens: completion_text_tokens, completion_audio_tokens: completion_audio_tokens, cost: cost, 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.
100 101 102 103 104 105 106 107 108 |
# File 'lib/vapi_server_sdk/types/voicemail_detection_cost.rb', line 100 def self.validate_raw(obj:) obj.model.is_a?(Hash) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.provider.is_a?(Vapi::VoicemailDetectionCostProvider) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.prompt_text_tokens.is_a?(Float) != false || raise("Passed value for field obj.prompt_text_tokens is not the expected type, validation failed.") obj.prompt_audio_tokens.is_a?(Float) != false || raise("Passed value for field obj.prompt_audio_tokens is not the expected type, validation failed.") obj.completion_text_tokens.is_a?(Float) != false || raise("Passed value for field obj.completion_text_tokens is not the expected type, validation failed.") obj.completion_audio_tokens.is_a?(Float) != false || raise("Passed value for field obj.completion_audio_tokens is not the expected type, validation failed.") obj.cost.is_a?(Float) != false || raise("Passed value for field obj.cost is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of VoicemailDetectionCost to a JSON object
90 91 92 |
# File 'lib/vapi_server_sdk/types/voicemail_detection_cost.rb', line 90 def to_json(*_args) @_field_set&.to_json end |