Class: LaunchDarklyApi::AgentOptimizationPost

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/launchdarkly_api/models/agent_optimization_post.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 = {}) ⇒ AgentOptimizationPost

Initializes the object

Parameters:

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

    Model attributes in the form of hash



116
117
118
119
120
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 116

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

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

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

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

  if attributes.key?(:'ground_truth_responses')
    if (value = attributes[:'ground_truth_responses']).is_a?(Array)
      self.ground_truth_responses = value
    end
  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
end

Instance Attribute Details

#acceptance_statementsObject

Returns the value of attribute acceptance_statements.



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

def acceptance_statements
  @acceptance_statements
end

#ai_config_keyObject

Returns the value of attribute ai_config_key.



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

def ai_config_key
  @ai_config_key
end

#auto_commitObject

Returns the value of attribute auto_commit.



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

def auto_commit
  @auto_commit
end

#ground_truth_responsesObject

Returns the value of attribute ground_truth_responses.



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

def ground_truth_responses
  @ground_truth_responses
end

#judge_modelObject

Returns the value of attribute judge_model.



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

def judge_model
  @judge_model
end

#judgesObject

Returns the value of attribute judges.



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

def judges
  @judges
end

#keyObject

Returns the value of attribute key.



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

def key
  @key
end

#labelObject

Returns the value of attribute label.



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

def label
  @label
end

#latency_optimizationObject

Returns the value of attribute latency_optimization.



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

def latency_optimization
  @latency_optimization
end

#max_attemptsObject

Returns the value of attribute max_attempts.



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

def max_attempts
  @max_attempts
end

#metric_keyObject

Returns the value of attribute metric_key.



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

def metric_key
  @metric_key
end

#model_choicesObject

Returns the value of attribute model_choices.



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

def model_choices
  @model_choices
end

#token_limitObject

Returns the value of attribute token_limit.



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

def token_limit
  @token_limit
end

#token_optimizationObject

Returns the value of attribute token_optimization.



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

def token_optimization
  @token_optimization
end

#user_input_optionsObject

Returns the value of attribute user_input_options.



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

def user_input_options
  @user_input_options
end

#variable_choicesObject

Returns the value of attribute variable_choices.



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

def variable_choices
  @variable_choices
end

#variation_keyObject

Returns the value of attribute variation_key.



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

def variation_key
  @variation_key
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



76
77
78
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 76

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



81
82
83
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 81

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 53

def self.attribute_map
  {
    :'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'
  }
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



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 333

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



109
110
111
112
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 109

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

.openapi_typesObject

Attribute type mapping.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 86

def self.openapi_types
  {
    :'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'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 296

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      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
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


320
321
322
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 320

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



326
327
328
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 326

def hash
  [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].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 221

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  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 @judge_model.nil?
    invalid_properties.push('invalid value for "judge_model", judge_model 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



355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 355

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



245
246
247
248
249
250
251
252
# File 'lib/launchdarkly_api/models/agent_optimization_post.rb', line 245

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @key.nil?
  return false if @ai_config_key.nil?
  return false if @max_attempts.nil?
  return false if @judge_model.nil?
  true
end