Class: LaunchDarklyApi::AgentOptimization

Inherits:
ApiModelBase show all
Defined in:
lib/launchdarkly_api/models/agent_optimization.rb

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 = {}) ⇒ AgentOptimization

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

  if attributes.key?(:'model_choices')
    if (value = attributes[:'model_choices']).is_a?(Array)
      self.model_choices = value
    end
  else
    self.model_choices = nil
  end

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

  if attributes.key?(:'variable_choices')
    if (value = attributes[:'variable_choices']).is_a?(Array)
      self.variable_choices = value
    end
  else
    self.variable_choices = nil
  end

  if attributes.key?(:'acceptance_statements')
    if (value = attributes[:'acceptance_statements']).is_a?(Array)
      self.acceptance_statements = value
    end
  else
    self.acceptance_statements = nil
  end

  if attributes.key?(:'judges')
    if (value = attributes[:'judges']).is_a?(Array)
      self.judges = value
    end
  else
    self.judges = nil
  end

  if attributes.key?(:'user_input_options')
    if (value = attributes[:'user_input_options']).is_a?(Array)
      self.user_input_options = value
    end
  else
    self.user_input_options = nil
  end

  if attributes.key?(:'ground_truth_responses')
    if (value = attributes[:'ground_truth_responses']).is_a?(Array)
      self.ground_truth_responses = value
    end
  else
    self.ground_truth_responses = nil
  end

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#_accessObject

Returns the value of attribute _access.



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

def _access
  @_access
end

Returns the value of attribute _links.



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

def _links
  @_links
end

#acceptance_statementsObject

Returns the value of attribute acceptance_statements.



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

def acceptance_statements
  @acceptance_statements
end

#ai_config_keyObject

Returns the value of attribute ai_config_key.



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

def ai_config_key
  @ai_config_key
end

#auto_commitObject

Returns the value of attribute auto_commit.



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

def auto_commit
  @auto_commit
end

#created_atObject

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#ground_truth_responsesObject

Returns the value of attribute ground_truth_responses.



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

def ground_truth_responses
  @ground_truth_responses
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#judge_modelObject

Returns the value of attribute judge_model.



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

def judge_model
  @judge_model
end

#judgesObject

Returns the value of attribute judges.



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

def judges
  @judges
end

#keyObject

Returns the value of attribute key.



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

def key
  @key
end

#labelObject

Returns the value of attribute label.



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

def label
  @label
end

#latency_optimizationObject

Returns the value of attribute latency_optimization.



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

def latency_optimization
  @latency_optimization
end

#max_attemptsObject

Returns the value of attribute max_attempts.



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

def max_attempts
  @max_attempts
end

#metric_keyObject

Returns the value of attribute metric_key.



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

def metric_key
  @metric_key
end

#model_choicesObject

Returns the value of attribute model_choices.



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

def model_choices
  @model_choices
end

#token_limitObject

Returns the value of attribute token_limit.



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

def token_limit
  @token_limit
end

#token_optimizationObject

Returns the value of attribute token_optimization.



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

def token_optimization
  @token_optimization
end

#user_input_optionsObject

Returns the value of attribute user_input_options.



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

def user_input_options
  @user_input_options
end

#variable_choicesObject

Returns the value of attribute variable_choices.



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

def variable_choices
  @variable_choices
end

#variation_keyObject

Returns the value of attribute variation_key.



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

def variation_key
  @variation_key
end

#versionObject

Returns the value of attribute version.



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

def version
  @version
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



91
92
93
# File 'lib/launchdarkly_api/models/agent_optimization.rb', line 91

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



96
97
98
# File 'lib/launchdarkly_api/models/agent_optimization.rb', line 96

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/launchdarkly_api/models/agent_optimization.rb', line 63

def self.attribute_map
  {
    :'_access' => :'_access',
    :'_links' => :'_links',
    :'id' => :'id',
    :'key' => :'key',
    :'ai_config_key' => :'aiConfigKey',
    :'max_attempts' => :'maxAttempts',
    :'model_choices' => :'modelChoices',
    :'judge_model' => :'judgeModel',
    :'variable_choices' => :'variableChoices',
    :'acceptance_statements' => :'acceptanceStatements',
    :'judges' => :'judges',
    :'user_input_options' => :'userInputOptions',
    :'ground_truth_responses' => :'groundTruthResponses',
    :'metric_key' => :'metricKey',
    :'token_limit' => :'tokenLimit',
    :'variation_key' => :'variationKey',
    :'label' => :'label',
    :'latency_optimization' => :'latencyOptimization',
    :'token_optimization' => :'tokenOptimization',
    :'auto_commit' => :'autoCommit',
    :'version' => :'version',
    :'created_at' => :'createdAt'
  }
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



531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'lib/launchdarkly_api/models/agent_optimization.rb', line 531

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



129
130
131
132
# File 'lib/launchdarkly_api/models/agent_optimization.rb', line 129

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

.openapi_typesObject

Attribute type mapping.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/launchdarkly_api/models/agent_optimization.rb', line 101

def self.openapi_types
  {
    :'_access' => :'AiConfigsAccess',
    :'_links' => :'ParentAndSelfLinks',
    :'id' => :'String',
    :'key' => :'String',
    :'ai_config_key' => :'String',
    :'max_attempts' => :'Integer',
    :'model_choices' => :'Array<String>',
    :'judge_model' => :'String',
    :'variable_choices' => :'Array<Hash<String, Object>>',
    :'acceptance_statements' => :'Array<AgentOptimizationAcceptanceStatement>',
    :'judges' => :'Array<AgentOptimizationJudge>',
    :'user_input_options' => :'Array<String>',
    :'ground_truth_responses' => :'Array<String>',
    :'metric_key' => :'String',
    :'token_limit' => :'Integer',
    :'variation_key' => :'String',
    :'label' => :'String',
    :'latency_optimization' => :'Boolean',
    :'token_optimization' => :'Boolean',
    :'auto_commit' => :'Boolean',
    :'version' => :'Integer',
    :'created_at' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/launchdarkly_api/models/agent_optimization.rb', line 489

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      _access == o._access &&
      _links == o._links &&
      id == o.id &&
      key == o.key &&
      ai_config_key == o.ai_config_key &&
      max_attempts == o.max_attempts &&
      model_choices == o.model_choices &&
      judge_model == o.judge_model &&
      variable_choices == o.variable_choices &&
      acceptance_statements == o.acceptance_statements &&
      judges == o.judges &&
      user_input_options == o.user_input_options &&
      ground_truth_responses == o.ground_truth_responses &&
      metric_key == o.metric_key &&
      token_limit == o.token_limit &&
      variation_key == o.variation_key &&
      label == o.label &&
      latency_optimization == o.latency_optimization &&
      token_optimization == o.token_optimization &&
      auto_commit == o.auto_commit &&
      version == o.version &&
      created_at == o.created_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


518
519
520
# File 'lib/launchdarkly_api/models/agent_optimization.rb', line 518

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



524
525
526
# File 'lib/launchdarkly_api/models/agent_optimization.rb', line 524

def hash
  [_access, _links, id, key, ai_config_key, max_attempts, model_choices, judge_model, variable_choices, acceptance_statements, judges, user_input_options, ground_truth_responses, metric_key, token_limit, variation_key, label, latency_optimization, token_optimization, auto_commit, version, created_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



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
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
# File 'lib/launchdarkly_api/models/agent_optimization.rb', line 279

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 @key.nil?
    invalid_properties.push('invalid value for "key", key cannot be nil.')
  end

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

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

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

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

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

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

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

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

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

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

  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_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



553
554
555
556
557
558
559
560
561
562
563
564
565
# File 'lib/launchdarkly_api/models/agent_optimization.rb', line 553

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



339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/launchdarkly_api/models/agent_optimization.rb', line 339

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @key.nil?
  return false if @ai_config_key.nil?
  return false if @max_attempts.nil?
  return false if @model_choices.nil?
  return false if @judge_model.nil?
  return false if @variable_choices.nil?
  return false if @acceptance_statements.nil?
  return false if @judges.nil?
  return false if @user_input_options.nil?
  return false if @ground_truth_responses.nil?
  return false if @version.nil?
  return false if @created_at.nil?
  true
end