Class: Vapi::CostBreakdown
- Inherits:
-
Object
- Object
- Vapi::CostBreakdown
- Defined in:
- lib/vapi_server_sdk/types/cost_breakdown.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#analysis_cost_breakdown ⇒ Vapi::AnalysisCostBreakdown
readonly
This is the cost of the analysis.
-
#llm ⇒ Float
readonly
This is the cost of the language model.
-
#llm_completion_tokens ⇒ Float
readonly
This is the LLM completion tokens used for the call.
-
#llm_prompt_tokens ⇒ Float
readonly
This is the LLM prompt tokens used for the call.
-
#stt ⇒ Float
readonly
This is the cost of the speech-to-text service.
-
#total ⇒ Float
readonly
This is the total cost of the call.
-
#transport ⇒ Float
readonly
This is the cost of the transport provider, like Twilio or Vonage.
-
#tts ⇒ Float
readonly
This is the cost of the text-to-speech service.
-
#tts_characters ⇒ Float
readonly
This is the TTS characters used for the call.
-
#vapi ⇒ Float
readonly
This is the cost of Vapi.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::CostBreakdown
Deserialize a JSON object to an instance of CostBreakdown.
-
.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(transport: OMIT, stt: OMIT, llm: OMIT, tts: OMIT, vapi: OMIT, total: OMIT, llm_prompt_tokens: OMIT, llm_completion_tokens: OMIT, tts_characters: OMIT, analysis_cost_breakdown: OMIT, additional_properties: nil) ⇒ Vapi::CostBreakdown constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CostBreakdown to a JSON object.
Constructor Details
#initialize(transport: OMIT, stt: OMIT, llm: OMIT, tts: OMIT, vapi: OMIT, total: OMIT, llm_prompt_tokens: OMIT, llm_completion_tokens: OMIT, tts_characters: OMIT, analysis_cost_breakdown: OMIT, additional_properties: nil) ⇒ Vapi::CostBreakdown
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 49 def initialize(transport: OMIT, stt: OMIT, llm: OMIT, tts: OMIT, vapi: OMIT, total: OMIT, llm_prompt_tokens: OMIT, llm_completion_tokens: OMIT, tts_characters: OMIT, analysis_cost_breakdown: OMIT, additional_properties: nil) @transport = transport if transport != OMIT @stt = stt if stt != OMIT @llm = llm if llm != OMIT @tts = tts if tts != OMIT @vapi = vapi if vapi != OMIT @total = total if total != OMIT @llm_prompt_tokens = llm_prompt_tokens if llm_prompt_tokens != OMIT @llm_completion_tokens = llm_completion_tokens if llm_completion_tokens != OMIT @tts_characters = tts_characters if tts_characters != OMIT @analysis_cost_breakdown = analysis_cost_breakdown if analysis_cost_breakdown != OMIT @additional_properties = additional_properties @_field_set = { "transport": transport, "stt": stt, "llm": llm, "tts": tts, "vapi": vapi, "total": total, "llmPromptTokens": llm_prompt_tokens, "llmCompletionTokens": llm_completion_tokens, "ttsCharacters": tts_characters, "analysisCostBreakdown": analysis_cost_breakdown }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
30 31 32 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 30 def additional_properties @additional_properties end |
#analysis_cost_breakdown ⇒ Vapi::AnalysisCostBreakdown (readonly)
Returns This is the cost of the analysis.
28 29 30 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 28 def analysis_cost_breakdown @analysis_cost_breakdown end |
#llm ⇒ Float (readonly)
Returns This is the cost of the language model.
14 15 16 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 14 def llm @llm end |
#llm_completion_tokens ⇒ Float (readonly)
Returns This is the LLM completion tokens used for the call.
24 25 26 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 24 def llm_completion_tokens @llm_completion_tokens end |
#llm_prompt_tokens ⇒ Float (readonly)
Returns This is the LLM prompt tokens used for the call.
22 23 24 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 22 def llm_prompt_tokens @llm_prompt_tokens end |
#stt ⇒ Float (readonly)
Returns This is the cost of the speech-to-text service.
12 13 14 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 12 def stt @stt end |
#total ⇒ Float (readonly)
Returns This is the total cost of the call.
20 21 22 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 20 def total @total end |
#transport ⇒ Float (readonly)
Returns This is the cost of the transport provider, like Twilio or Vonage.
10 11 12 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 10 def transport @transport end |
#tts ⇒ Float (readonly)
Returns This is the cost of the text-to-speech service.
16 17 18 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 16 def tts @tts end |
#tts_characters ⇒ Float (readonly)
Returns This is the TTS characters used for the call.
26 27 28 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 26 def tts_characters @tts_characters end |
#vapi ⇒ Float (readonly)
Returns This is the cost of Vapi.
18 19 20 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 18 def vapi @vapi end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::CostBreakdown
Deserialize a JSON object to an instance of CostBreakdown
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 82 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) transport = parsed_json["transport"] stt = parsed_json["stt"] llm = parsed_json["llm"] tts = parsed_json["tts"] vapi = parsed_json["vapi"] total = parsed_json["total"] llm_prompt_tokens = parsed_json["llmPromptTokens"] llm_completion_tokens = parsed_json["llmCompletionTokens"] tts_characters = parsed_json["ttsCharacters"] if parsed_json["analysisCostBreakdown"].nil? analysis_cost_breakdown = nil else analysis_cost_breakdown = parsed_json["analysisCostBreakdown"].to_json analysis_cost_breakdown = Vapi::AnalysisCostBreakdown.from_json(json_object: analysis_cost_breakdown) end new( transport: transport, stt: stt, llm: llm, tts: tts, vapi: vapi, total: total, llm_prompt_tokens: llm_prompt_tokens, llm_completion_tokens: llm_completion_tokens, tts_characters: tts_characters, analysis_cost_breakdown: analysis_cost_breakdown, 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.
128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 128 def self.validate_raw(obj:) obj.transport&.is_a?(Float) != false || raise("Passed value for field obj.transport is not the expected type, validation failed.") obj.stt&.is_a?(Float) != false || raise("Passed value for field obj.stt is not the expected type, validation failed.") obj.llm&.is_a?(Float) != false || raise("Passed value for field obj.llm is not the expected type, validation failed.") obj.tts&.is_a?(Float) != false || raise("Passed value for field obj.tts is not the expected type, validation failed.") obj.vapi&.is_a?(Float) != false || raise("Passed value for field obj.vapi is not the expected type, validation failed.") obj.total&.is_a?(Float) != false || raise("Passed value for field obj.total is not the expected type, validation failed.") obj.llm_prompt_tokens&.is_a?(Float) != false || raise("Passed value for field obj.llm_prompt_tokens is not the expected type, validation failed.") obj.llm_completion_tokens&.is_a?(Float) != false || raise("Passed value for field obj.llm_completion_tokens is not the expected type, validation failed.") obj.tts_characters&.is_a?(Float) != false || raise("Passed value for field obj.tts_characters is not the expected type, validation failed.") obj.analysis_cost_breakdown.nil? || Vapi::AnalysisCostBreakdown.validate_raw(obj: obj.analysis_cost_breakdown) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CostBreakdown to a JSON object
118 119 120 |
# File 'lib/vapi_server_sdk/types/cost_breakdown.rb', line 118 def to_json(*_args) @_field_set&.to_json end |