Class: LaunchDarklyApi::AgentOptimizationResult

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/launchdarkly_api/models/agent_optimization_result.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ AgentOptimizationResult

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
199
200
201
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 162

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `LaunchDarklyApi::AgentOptimizationResult` 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::AgentOptimizationResult`. 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?(:'_access')
    self._access = attributes[:'_access']
  end

  if attributes.key?(:'_links')
    self._links = attributes[:'_links']
  end

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  else
    self.id = nil
  end

  if attributes.key?(:'run_id')
    self.run_id = attributes[:'run_id']
  else
    self.run_id = nil
  end

  if attributes.key?(:'agent_optimization_id')
    self.agent_optimization_id = attributes[:'agent_optimization_id']
  else
    self.agent_optimization_id = nil
  end

  if attributes.key?(:'agent_optimization_version')
    self.agent_optimization_version = attributes[:'agent_optimization_version']
  else
    self.agent_optimization_version = nil
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  else
    self.status = nil
  end

  if attributes.key?(:'activity')
    self.activity = attributes[:'activity']
  else
    self.activity = nil
  end

  if attributes.key?(:'iteration')
    self.iteration = attributes[:'iteration']
  else
    self.iteration = nil
  end

  if attributes.key?(:'instructions')
    self.instructions = attributes[:'instructions']
  else
    self.instructions = nil
  end

  if attributes.key?(:'parameters')
    if (value = attributes[:'parameters']).is_a?(Hash)
      self.parameters = value
    end
  end

  if attributes.key?(:'user_input')
    self.user_input = attributes[:'user_input']
  else
    self.user_input = nil
  end

  if attributes.key?(:'completion_response')
    self.completion_response = attributes[:'completion_response']
  end

  if attributes.key?(:'variation')
    if (value = attributes[:'variation']).is_a?(Hash)
      self.variation = value
    end
  end

  if attributes.key?(:'scores')
    if (value = attributes[:'scores']).is_a?(Hash)
      self.scores = value
    end
  end

  if attributes.key?(:'generation_tokens')
    if (value = attributes[:'generation_tokens']).is_a?(Hash)
      self.generation_tokens = value
    end
  end

  if attributes.key?(:'evaluation_tokens')
    if (value = attributes[:'evaluation_tokens']).is_a?(Hash)
      self.evaluation_tokens = value
    end
  end

  if attributes.key?(:'generation_latency')
    self.generation_latency = attributes[:'generation_latency']
  end

  if attributes.key?(:'evaluation_latencies')
    if (value = attributes[:'evaluation_latencies']).is_a?(Hash)
      self.evaluation_latencies = value
    end
  end

  if attributes.key?(:'completed_at')
    self.completed_at = attributes[:'completed_at']
  end

  if attributes.key?(:'created_variation_key')
    self.created_variation_key = attributes[:'created_variation_key']
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  else
    self.created_at = nil
  end

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  else
    self.updated_at = nil
  end
end

Instance Attribute Details

#_accessObject

Returns the value of attribute _access.



18
19
20
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 18

def _access
  @_access
end

Returns the value of attribute _links.



20
21
22
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 20

def _links
  @_links
end

#activityObject

Returns the value of attribute activity.



32
33
34
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 32

def activity
  @activity
end

#agent_optimization_idObject

Returns the value of attribute agent_optimization_id.



26
27
28
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 26

def agent_optimization_id
  @agent_optimization_id
end

#agent_optimization_versionObject

Returns the value of attribute agent_optimization_version.



28
29
30
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 28

def agent_optimization_version
  @agent_optimization_version
end

#completed_atObject

Returns the value of attribute completed_at.



56
57
58
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 56

def completed_at
  @completed_at
end

#completion_responseObject

Returns the value of attribute completion_response.



42
43
44
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 42

def completion_response
  @completion_response
end

#created_atObject

Returns the value of attribute created_at.



60
61
62
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 60

def created_at
  @created_at
end

#created_variation_keyObject

Returns the value of attribute created_variation_key.



58
59
60
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 58

def created_variation_key
  @created_variation_key
end

#evaluation_latenciesObject

Returns the value of attribute evaluation_latencies.



54
55
56
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 54

def evaluation_latencies
  @evaluation_latencies
end

#evaluation_tokensObject

Returns the value of attribute evaluation_tokens.



50
51
52
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 50

def evaluation_tokens
  @evaluation_tokens
end

#generation_latencyObject

Returns the value of attribute generation_latency.



52
53
54
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 52

def generation_latency
  @generation_latency
end

#generation_tokensObject

Returns the value of attribute generation_tokens.



48
49
50
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 48

def generation_tokens
  @generation_tokens
end

#idObject

Returns the value of attribute id.



22
23
24
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 22

def id
  @id
end

#instructionsObject

Returns the value of attribute instructions.



36
37
38
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 36

def instructions
  @instructions
end

#iterationObject

Returns the value of attribute iteration.



34
35
36
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 34

def iteration
  @iteration
end

#parametersObject

Returns the value of attribute parameters.



38
39
40
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 38

def parameters
  @parameters
end

#run_idObject

Returns the value of attribute run_id.



24
25
26
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 24

def run_id
  @run_id
end

#scoresObject

Returns the value of attribute scores.



46
47
48
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 46

def scores
  @scores
end

#statusObject

Returns the value of attribute status.



30
31
32
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 30

def status
  @status
end

#updated_atObject

Returns the value of attribute updated_at.



62
63
64
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 62

def updated_at
  @updated_at
end

#user_inputObject

Returns the value of attribute user_input.



40
41
42
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 40

def user_input
  @user_input
end

#variationObject

Returns the value of attribute variation.



44
45
46
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 44

def variation
  @variation
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



116
117
118
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 116

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



121
122
123
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 121

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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/launchdarkly_api/models/agent_optimization_result.rb', line 87

def self.attribute_map
  {
    :'_access' => :'_access',
    :'_links' => :'_links',
    :'id' => :'id',
    :'run_id' => :'runId',
    :'agent_optimization_id' => :'agentOptimizationId',
    :'agent_optimization_version' => :'agentOptimizationVersion',
    :'status' => :'status',
    :'activity' => :'activity',
    :'iteration' => :'iteration',
    :'instructions' => :'instructions',
    :'parameters' => :'parameters',
    :'user_input' => :'userInput',
    :'completion_response' => :'completionResponse',
    :'variation' => :'variation',
    :'scores' => :'scores',
    :'generation_tokens' => :'generationTokens',
    :'evaluation_tokens' => :'evaluationTokens',
    :'generation_latency' => :'generationLatency',
    :'evaluation_latencies' => :'evaluationLatencies',
    :'completed_at' => :'completedAt',
    :'created_variation_key' => :'createdVariationKey',
    :'created_at' => :'createdAt',
    :'updated_at' => :'updatedAt'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 528

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_nullableObject

List of attributes with nullable: true



155
156
157
158
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 155

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 126

def self.openapi_types
  {
    :'_access' => :'AiConfigsAccess',
    :'_links' => :'ParentAndSelfLinks',
    :'id' => :'String',
    :'run_id' => :'String',
    :'agent_optimization_id' => :'String',
    :'agent_optimization_version' => :'Integer',
    :'status' => :'AgentOptimizationResultStatus',
    :'activity' => :'AgentOptimizationResultActivity',
    :'iteration' => :'Integer',
    :'instructions' => :'String',
    :'parameters' => :'Hash<String, Object>',
    :'user_input' => :'String',
    :'completion_response' => :'String',
    :'variation' => :'Hash<String, Object>',
    :'scores' => :'Hash<String, Object>',
    :'generation_tokens' => :'Hash<String, Object>',
    :'evaluation_tokens' => :'Hash<String, Object>',
    :'generation_latency' => :'Integer',
    :'evaluation_latencies' => :'Hash<String, Object>',
    :'completed_at' => :'Integer',
    :'created_variation_key' => :'String',
    :'created_at' => :'Integer',
    :'updated_at' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 485

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      _access == o._access &&
      _links == o._links &&
      id == o.id &&
      run_id == o.run_id &&
      agent_optimization_id == o.agent_optimization_id &&
      agent_optimization_version == o.agent_optimization_version &&
      status == o.status &&
      activity == o.activity &&
      iteration == o.iteration &&
      instructions == o.instructions &&
      parameters == o.parameters &&
      user_input == o.user_input &&
      completion_response == o.completion_response &&
      variation == o.variation &&
      scores == o.scores &&
      generation_tokens == o.generation_tokens &&
      evaluation_tokens == o.evaluation_tokens &&
      generation_latency == o.generation_latency &&
      evaluation_latencies == o.evaluation_latencies &&
      completed_at == o.completed_at &&
      created_variation_key == o.created_variation_key &&
      created_at == o.created_at &&
      updated_at == o.updated_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


515
516
517
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 515

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



521
522
523
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 521

def hash
  [_access, _links, id, run_id, agent_optimization_id, agent_optimization_version, status, activity, iteration, instructions, parameters, user_input, completion_response, variation, scores, generation_tokens, evaluation_tokens, generation_latency, evaluation_latencies, completed_at, created_variation_key, created_at, updated_at].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 305

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @run_id.nil?
    invalid_properties.push('invalid value for "run_id", run_id cannot be nil.')
  end

  if @agent_optimization_id.nil?
    invalid_properties.push('invalid value for "agent_optimization_id", agent_optimization_id cannot be nil.')
  end

  if @agent_optimization_version.nil?
    invalid_properties.push('invalid value for "agent_optimization_version", agent_optimization_version cannot be nil.')
  end

  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  if @activity.nil?
    invalid_properties.push('invalid value for "activity", activity cannot be nil.')
  end

  if @iteration.nil?
    invalid_properties.push('invalid value for "iteration", iteration cannot be nil.')
  end

  if @instructions.nil?
    invalid_properties.push('invalid value for "instructions", instructions cannot be nil.')
  end

  if @user_input.nil?
    invalid_properties.push('invalid value for "user_input", user_input cannot be nil.')
  end

  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  if @updated_at.nil?
    invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 550

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

Returns:

  • (Boolean)

    true if the model is valid



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/launchdarkly_api/models/agent_optimization_result.rb', line 357

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @run_id.nil?
  return false if @agent_optimization_id.nil?
  return false if @agent_optimization_version.nil?
  return false if @status.nil?
  return false if @activity.nil?
  return false if @iteration.nil?
  return false if @instructions.nil?
  return false if @user_input.nil?
  return false if @created_at.nil?
  return false if @updated_at.nil?
  true
end