Class: LaunchDarklyApi::AgentOptimizationPatch

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



108
109
110
111
112
113
114
115
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
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 108

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



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

def acceptance_statements
  @acceptance_statements
end

#auto_commitObject

Returns the value of attribute auto_commit.



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

def auto_commit
  @auto_commit
end

#ground_truth_responsesObject

Returns the value of attribute ground_truth_responses.



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

def ground_truth_responses
  @ground_truth_responses
end

#judge_modelObject

Returns the value of attribute judge_model.



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

def judge_model
  @judge_model
end

#judgesObject

Returns the value of attribute judges.



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

def judges
  @judges
end

#labelObject

Returns the value of attribute label.



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

def label
  @label
end

#latency_optimizationObject

Returns the value of attribute latency_optimization.



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

def latency_optimization
  @latency_optimization
end

#max_attemptsObject

Returns the value of attribute max_attempts.



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

def max_attempts
  @max_attempts
end

#metric_keyObject

Returns the value of attribute metric_key.



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

def metric_key
  @metric_key
end

#model_choicesObject

Returns the value of attribute model_choices.



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

def model_choices
  @model_choices
end

#token_limitObject

Returns the value of attribute token_limit.



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

def token_limit
  @token_limit
end

#token_optimizationObject

Returns the value of attribute token_optimization.



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

def token_optimization
  @token_optimization
end

#user_input_optionsObject

Returns the value of attribute user_input_options.



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

def user_input_options
  @user_input_options
end

#variable_choicesObject

Returns the value of attribute variable_choices.



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

def variable_choices
  @variable_choices
end

#variation_keyObject

Returns the value of attribute variation_key.



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

def variation_key
  @variation_key
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



70
71
72
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 70

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



75
76
77
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 75

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 49

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



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 247

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



101
102
103
104
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 101

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

.openapi_typesObject

Attribute type mapping.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 80

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



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 212

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


234
235
236
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 234

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



240
241
242
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 240

def hash
  [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



197
198
199
200
201
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 197

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 269

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



205
206
207
208
# File 'lib/launchdarkly_api/models/agent_optimization_patch.rb', line 205

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end