Class: Vapi::AnalysisCostBreakdown
- Inherits:
-
Object
- Object
- Vapi::AnalysisCostBreakdown
- Defined in:
- lib/vapi_server_sdk/types/analysis_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.
-
#structured_data ⇒ Float
readonly
This is the cost to extract structured data from the call.
-
#structured_data_completion_tokens ⇒ Float
readonly
This is the number of completion tokens used to extract structured data from the call.
-
#structured_data_prompt_tokens ⇒ Float
readonly
This is the number of prompt tokens used to extract structured data from the call.
-
#success_evaluation ⇒ Float
readonly
This is the cost to evaluate if the call was successful.
-
#success_evaluation_completion_tokens ⇒ Float
readonly
This is the number of completion tokens used to evaluate if the call was successful.
-
#success_evaluation_prompt_tokens ⇒ Float
readonly
This is the number of prompt tokens used to evaluate if the call was successful.
-
#summary ⇒ Float
readonly
This is the cost to summarize the call.
-
#summary_completion_tokens ⇒ Float
readonly
This is the number of completion tokens used to summarize the call.
-
#summary_prompt_tokens ⇒ Float
readonly
This is the number of prompt tokens used to summarize the call.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::AnalysisCostBreakdown
Deserialize a JSON object to an instance of AnalysisCostBreakdown.
-
.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(summary: OMIT, summary_prompt_tokens: OMIT, summary_completion_tokens: OMIT, structured_data: OMIT, structured_data_prompt_tokens: OMIT, structured_data_completion_tokens: OMIT, success_evaluation: OMIT, success_evaluation_prompt_tokens: OMIT, success_evaluation_completion_tokens: OMIT, additional_properties: nil) ⇒ Vapi::AnalysisCostBreakdown constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AnalysisCostBreakdown to a JSON object.
Constructor Details
#initialize(summary: OMIT, summary_prompt_tokens: OMIT, summary_completion_tokens: OMIT, structured_data: OMIT, structured_data_prompt_tokens: OMIT, structured_data_completion_tokens: OMIT, success_evaluation: OMIT, success_evaluation_prompt_tokens: OMIT, success_evaluation_completion_tokens: OMIT, additional_properties: nil) ⇒ Vapi::AnalysisCostBreakdown
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 77 78 79 80 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 51 def initialize(summary: OMIT, summary_prompt_tokens: OMIT, summary_completion_tokens: OMIT, structured_data: OMIT, structured_data_prompt_tokens: OMIT, structured_data_completion_tokens: OMIT, success_evaluation: OMIT, success_evaluation_prompt_tokens: OMIT, success_evaluation_completion_tokens: OMIT, additional_properties: nil) @summary = summary if summary != OMIT @summary_prompt_tokens = summary_prompt_tokens if summary_prompt_tokens != OMIT @summary_completion_tokens = summary_completion_tokens if summary_completion_tokens != OMIT @structured_data = structured_data if structured_data != OMIT @structured_data_prompt_tokens = structured_data_prompt_tokens if structured_data_prompt_tokens != OMIT if structured_data_completion_tokens != OMIT @structured_data_completion_tokens = structured_data_completion_tokens end @success_evaluation = success_evaluation if success_evaluation != OMIT @success_evaluation_prompt_tokens = success_evaluation_prompt_tokens if success_evaluation_prompt_tokens != OMIT if success_evaluation_completion_tokens != OMIT @success_evaluation_completion_tokens = success_evaluation_completion_tokens end @additional_properties = additional_properties @_field_set = { "summary": summary, "summaryPromptTokens": summary_prompt_tokens, "summaryCompletionTokens": summary_completion_tokens, "structuredData": structured_data, "structuredDataPromptTokens": structured_data_prompt_tokens, "structuredDataCompletionTokens": structured_data_completion_tokens, "successEvaluation": success_evaluation, "successEvaluationPromptTokens": success_evaluation_prompt_tokens, "successEvaluationCompletionTokens": success_evaluation_completion_tokens }.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/analysis_cost_breakdown.rb', line 30 def additional_properties @additional_properties end |
#structured_data ⇒ Float (readonly)
Returns This is the cost to extract structured data from the call.
15 16 17 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 15 def structured_data @structured_data end |
#structured_data_completion_tokens ⇒ Float (readonly)
Returns This is the number of completion tokens used to extract structured data from the call.
21 22 23 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 21 def structured_data_completion_tokens @structured_data_completion_tokens end |
#structured_data_prompt_tokens ⇒ Float (readonly)
Returns This is the number of prompt tokens used to extract structured data from the call.
18 19 20 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 18 def structured_data_prompt_tokens @structured_data_prompt_tokens end |
#success_evaluation ⇒ Float (readonly)
Returns This is the cost to evaluate if the call was successful.
23 24 25 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 23 def success_evaluation @success_evaluation end |
#success_evaluation_completion_tokens ⇒ Float (readonly)
Returns This is the number of completion tokens used to evaluate if the call was successful.
28 29 30 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 28 def success_evaluation_completion_tokens @success_evaluation_completion_tokens end |
#success_evaluation_prompt_tokens ⇒ Float (readonly)
Returns This is the number of prompt tokens used to evaluate if the call was successful.
25 26 27 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 25 def success_evaluation_prompt_tokens @success_evaluation_prompt_tokens end |
#summary ⇒ Float (readonly)
Returns This is the cost to summarize the call.
9 10 11 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 9 def summary @summary end |
#summary_completion_tokens ⇒ Float (readonly)
Returns This is the number of completion tokens used to summarize the call.
13 14 15 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 13 def summary_completion_tokens @summary_completion_tokens end |
#summary_prompt_tokens ⇒ Float (readonly)
Returns This is the number of prompt tokens used to summarize the call.
11 12 13 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 11 def summary_prompt_tokens @summary_prompt_tokens end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::AnalysisCostBreakdown
Deserialize a JSON object to an instance of AnalysisCostBreakdown
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 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 86 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) summary = parsed_json["summary"] summary_prompt_tokens = parsed_json["summaryPromptTokens"] summary_completion_tokens = parsed_json["summaryCompletionTokens"] structured_data = parsed_json["structuredData"] structured_data_prompt_tokens = parsed_json["structuredDataPromptTokens"] structured_data_completion_tokens = parsed_json["structuredDataCompletionTokens"] success_evaluation = parsed_json["successEvaluation"] success_evaluation_prompt_tokens = parsed_json["successEvaluationPromptTokens"] success_evaluation_completion_tokens = parsed_json["successEvaluationCompletionTokens"] new( summary: summary, summary_prompt_tokens: summary_prompt_tokens, summary_completion_tokens: summary_completion_tokens, structured_data: structured_data, structured_data_prompt_tokens: structured_data_prompt_tokens, structured_data_completion_tokens: structured_data_completion_tokens, success_evaluation: success_evaluation, success_evaluation_prompt_tokens: success_evaluation_prompt_tokens, success_evaluation_completion_tokens: success_evaluation_completion_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.
125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 125 def self.validate_raw(obj:) obj.summary&.is_a?(Float) != false || raise("Passed value for field obj.summary is not the expected type, validation failed.") obj.summary_prompt_tokens&.is_a?(Float) != false || raise("Passed value for field obj.summary_prompt_tokens is not the expected type, validation failed.") obj.summary_completion_tokens&.is_a?(Float) != false || raise("Passed value for field obj.summary_completion_tokens is not the expected type, validation failed.") obj.structured_data&.is_a?(Float) != false || raise("Passed value for field obj.structured_data is not the expected type, validation failed.") obj.structured_data_prompt_tokens&.is_a?(Float) != false || raise("Passed value for field obj.structured_data_prompt_tokens is not the expected type, validation failed.") obj.structured_data_completion_tokens&.is_a?(Float) != false || raise("Passed value for field obj.structured_data_completion_tokens is not the expected type, validation failed.") obj.success_evaluation&.is_a?(Float) != false || raise("Passed value for field obj.success_evaluation is not the expected type, validation failed.") obj.success_evaluation_prompt_tokens&.is_a?(Float) != false || raise("Passed value for field obj.success_evaluation_prompt_tokens is not the expected type, validation failed.") obj.success_evaluation_completion_tokens&.is_a?(Float) != false || raise("Passed value for field obj.success_evaluation_completion_tokens is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of AnalysisCostBreakdown to a JSON object
115 116 117 |
# File 'lib/vapi_server_sdk/types/analysis_cost_breakdown.rb', line 115 def to_json(*_args) @_field_set&.to_json end |