Class: LaunchDarklyApi::Metrics
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- LaunchDarklyApi::Metrics
- Defined in:
- lib/launchdarkly_api/models/metrics.rb
Instance Attribute Summary collapse
-
#duration_ms ⇒ Object
Returns the value of attribute duration_ms.
-
#generation_count ⇒ Object
Number of attempted generations.
-
#generation_error_count ⇒ Object
Number of generations with errors.
-
#generation_success_count ⇒ Object
Number of successful generations.
-
#input_cost ⇒ Object
Cost of input tokens in USD.
-
#input_tokens ⇒ Object
Returns the value of attribute input_tokens.
-
#judge_accuracy ⇒ Object
Average accuracy judge score (0.0-1.0).
-
#judge_relevance ⇒ Object
Average relevance judge score (0.0-1.0).
-
#judge_toxicity ⇒ Object
Average toxicity judge score (0.0-1.0).
-
#output_cost ⇒ Object
Cost of output tokens in USD.
-
#output_tokens ⇒ Object
Returns the value of attribute output_tokens.
-
#satisfaction_rating ⇒ Object
A value between 0 and 1 representing satisfaction rating.
-
#thumbs_down ⇒ Object
Returns the value of attribute thumbs_down.
-
#thumbs_up ⇒ Object
Returns the value of attribute thumbs_up.
-
#time_to_first_token_ms ⇒ Object
Returns the value of attribute time_to_first_token_ms.
-
#total_tokens ⇒ Object
Returns the value of attribute total_tokens.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Metrics
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Metrics
Initializes the object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 121 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `LaunchDarklyApi::Metrics` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `LaunchDarklyApi::Metrics`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'input_tokens') self.input_tokens = attributes[:'input_tokens'] end if attributes.key?(:'output_tokens') self.output_tokens = attributes[:'output_tokens'] end if attributes.key?(:'total_tokens') self.total_tokens = attributes[:'total_tokens'] end if attributes.key?(:'generation_count') self.generation_count = attributes[:'generation_count'] end if attributes.key?(:'generation_success_count') self.generation_success_count = attributes[:'generation_success_count'] end if attributes.key?(:'generation_error_count') self.generation_error_count = attributes[:'generation_error_count'] end if attributes.key?(:'thumbs_up') self.thumbs_up = attributes[:'thumbs_up'] end if attributes.key?(:'thumbs_down') self.thumbs_down = attributes[:'thumbs_down'] end if attributes.key?(:'duration_ms') self.duration_ms = attributes[:'duration_ms'] end if attributes.key?(:'time_to_first_token_ms') self.time_to_first_token_ms = attributes[:'time_to_first_token_ms'] end if attributes.key?(:'satisfaction_rating') self. = attributes[:'satisfaction_rating'] end if attributes.key?(:'input_cost') self.input_cost = attributes[:'input_cost'] end if attributes.key?(:'output_cost') self.output_cost = attributes[:'output_cost'] end if attributes.key?(:'judge_accuracy') self.judge_accuracy = attributes[:'judge_accuracy'] end if attributes.key?(:'judge_relevance') self.judge_relevance = attributes[:'judge_relevance'] end if attributes.key?(:'judge_toxicity') self.judge_toxicity = attributes[:'judge_toxicity'] end end |
Instance Attribute Details
#duration_ms ⇒ Object
Returns the value of attribute duration_ms.
37 38 39 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 37 def duration_ms @duration_ms end |
#generation_count ⇒ Object
Number of attempted generations
25 26 27 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 25 def generation_count @generation_count end |
#generation_error_count ⇒ Object
Number of generations with errors
31 32 33 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 31 def generation_error_count @generation_error_count end |
#generation_success_count ⇒ Object
Number of successful generations
28 29 30 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 28 def generation_success_count @generation_success_count end |
#input_cost ⇒ Object
Cost of input tokens in USD
45 46 47 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 45 def input_cost @input_cost end |
#input_tokens ⇒ Object
Returns the value of attribute input_tokens.
18 19 20 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 18 def input_tokens @input_tokens end |
#judge_accuracy ⇒ Object
Average accuracy judge score (0.0-1.0)
51 52 53 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 51 def judge_accuracy @judge_accuracy end |
#judge_relevance ⇒ Object
Average relevance judge score (0.0-1.0)
54 55 56 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 54 def judge_relevance @judge_relevance end |
#judge_toxicity ⇒ Object
Average toxicity judge score (0.0-1.0)
57 58 59 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 57 def judge_toxicity @judge_toxicity end |
#output_cost ⇒ Object
Cost of output tokens in USD
48 49 50 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 48 def output_cost @output_cost end |
#output_tokens ⇒ Object
Returns the value of attribute output_tokens.
20 21 22 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 20 def output_tokens @output_tokens end |
#satisfaction_rating ⇒ Object
A value between 0 and 1 representing satisfaction rating
42 43 44 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 42 def @satisfaction_rating end |
#thumbs_down ⇒ Object
Returns the value of attribute thumbs_down.
35 36 37 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 35 def thumbs_down @thumbs_down end |
#thumbs_up ⇒ Object
Returns the value of attribute thumbs_up.
33 34 35 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 33 def thumbs_up @thumbs_up end |
#time_to_first_token_ms ⇒ Object
Returns the value of attribute time_to_first_token_ms.
39 40 41 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 39 def time_to_first_token_ms @time_to_first_token_ms end |
#total_tokens ⇒ Object
Returns the value of attribute total_tokens.
22 23 24 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 22 def total_tokens @total_tokens end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
82 83 84 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 82 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
87 88 89 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 87 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 60 def self.attribute_map { :'input_tokens' => :'inputTokens', :'output_tokens' => :'outputTokens', :'total_tokens' => :'totalTokens', :'generation_count' => :'generationCount', :'generation_success_count' => :'generationSuccessCount', :'generation_error_count' => :'generationErrorCount', :'thumbs_up' => :'thumbsUp', :'thumbs_down' => :'thumbsDown', :'duration_ms' => :'durationMs', :'time_to_first_token_ms' => :'timeToFirstTokenMs', :'satisfaction_rating' => :'satisfactionRating', :'input_cost' => :'inputCost', :'output_cost' => :'outputCost', :'judge_accuracy' => :'judgeAccuracy', :'judge_relevance' => :'judgeRelevance', :'judge_toxicity' => :'judgeToxicity' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 365 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
114 115 116 117 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 114 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 92 def self.openapi_types { :'input_tokens' => :'Integer', :'output_tokens' => :'Integer', :'total_tokens' => :'Integer', :'generation_count' => :'Integer', :'generation_success_count' => :'Integer', :'generation_error_count' => :'Integer', :'thumbs_up' => :'Integer', :'thumbs_down' => :'Integer', :'duration_ms' => :'Integer', :'time_to_first_token_ms' => :'Integer', :'satisfaction_rating' => :'Float', :'input_cost' => :'Float', :'output_cost' => :'Float', :'judge_accuracy' => :'Float', :'judge_relevance' => :'Float', :'judge_toxicity' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 329 def ==(o) return true if self.equal?(o) self.class == o.class && input_tokens == o.input_tokens && output_tokens == o.output_tokens && total_tokens == o.total_tokens && generation_count == o.generation_count && generation_success_count == o.generation_success_count && generation_error_count == o.generation_error_count && thumbs_up == o.thumbs_up && thumbs_down == o.thumbs_down && duration_ms == o.duration_ms && time_to_first_token_ms == o.time_to_first_token_ms && == o. && input_cost == o.input_cost && output_cost == o.output_cost && judge_accuracy == o.judge_accuracy && judge_relevance == o.judge_relevance && judge_toxicity == o.judge_toxicity end |
#eql?(o) ⇒ Boolean
352 353 354 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 352 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
358 359 360 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 358 def hash [input_tokens, output_tokens, total_tokens, generation_count, generation_success_count, generation_error_count, thumbs_up, thumbs_down, duration_ms, time_to_first_token_ms, , input_cost, output_cost, judge_accuracy, judge_relevance, judge_toxicity].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 202 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@satisfaction_rating.nil? && @satisfaction_rating > 1 invalid_properties.push('invalid value for "satisfaction_rating", must be smaller than or equal to 1.') end if !@satisfaction_rating.nil? && @satisfaction_rating < 0 invalid_properties.push('invalid value for "satisfaction_rating", must be greater than or equal to 0.') end if !@judge_accuracy.nil? && @judge_accuracy > 1 invalid_properties.push('invalid value for "judge_accuracy", must be smaller than or equal to 1.') end if !@judge_accuracy.nil? && @judge_accuracy < 0 invalid_properties.push('invalid value for "judge_accuracy", must be greater than or equal to 0.') end if !@judge_relevance.nil? && @judge_relevance > 1 invalid_properties.push('invalid value for "judge_relevance", must be smaller than or equal to 1.') end if !@judge_relevance.nil? && @judge_relevance < 0 invalid_properties.push('invalid value for "judge_relevance", must be greater than or equal to 0.') end if !@judge_toxicity.nil? && @judge_toxicity > 1 invalid_properties.push('invalid value for "judge_toxicity", must be smaller than or equal to 1.') end if !@judge_toxicity.nil? && @judge_toxicity < 0 invalid_properties.push('invalid value for "judge_toxicity", must be greater than or equal to 0.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
387 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 387 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/launchdarkly_api/models/metrics.rb', line 242 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@satisfaction_rating.nil? && @satisfaction_rating > 1 return false if !@satisfaction_rating.nil? && @satisfaction_rating < 0 return false if !@judge_accuracy.nil? && @judge_accuracy > 1 return false if !@judge_accuracy.nil? && @judge_accuracy < 0 return false if !@judge_relevance.nil? && @judge_relevance > 1 return false if !@judge_relevance.nil? && @judge_relevance < 0 return false if !@judge_toxicity.nil? && @judge_toxicity > 1 return false if !@judge_toxicity.nil? && @judge_toxicity < 0 true end |