Method: OpenApiOpenAIClient::CreateCompletionRequest#list_invalid_properties

Defined in:
lib/openapi_openai/models/create_completion_request.rb

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
302
303
304
# File 'lib/openapi_openai/models/create_completion_request.rb', line 236

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

  if !@max_tokens.nil? && @max_tokens < 0
    invalid_properties.push('invalid value for "max_tokens", must be greater than or equal to 0.')
  end

  if !@temperature.nil? && @temperature > 2
    invalid_properties.push('invalid value for "temperature", must be smaller than or equal to 2.')
  end

  if !@temperature.nil? && @temperature < 0
    invalid_properties.push('invalid value for "temperature", must be greater than or equal to 0.')
  end

  if !@top_p.nil? && @top_p > 1
    invalid_properties.push('invalid value for "top_p", must be smaller than or equal to 1.')
  end

  if !@top_p.nil? && @top_p < 0
    invalid_properties.push('invalid value for "top_p", must be greater than or equal to 0.')
  end

  if !@n.nil? && @n > 128
    invalid_properties.push('invalid value for "n", must be smaller than or equal to 128.')
  end

  if !@n.nil? && @n < 1
    invalid_properties.push('invalid value for "n", must be greater than or equal to 1.')
  end

  if !@logprobs.nil? && @logprobs > 5
    invalid_properties.push('invalid value for "logprobs", must be smaller than or equal to 5.')
  end

  if !@logprobs.nil? && @logprobs < 0
    invalid_properties.push('invalid value for "logprobs", must be greater than or equal to 0.')
  end

  if !@presence_penalty.nil? && @presence_penalty > 2
    invalid_properties.push('invalid value for "presence_penalty", must be smaller than or equal to 2.')
  end

  if !@presence_penalty.nil? && @presence_penalty < -2
    invalid_properties.push('invalid value for "presence_penalty", must be greater than or equal to -2.')
  end

  if !@frequency_penalty.nil? && @frequency_penalty > 2
    invalid_properties.push('invalid value for "frequency_penalty", must be smaller than or equal to 2.')
  end

  if !@frequency_penalty.nil? && @frequency_penalty < -2
    invalid_properties.push('invalid value for "frequency_penalty", must be greater than or equal to -2.')
  end

  if !@best_of.nil? && @best_of > 20
    invalid_properties.push('invalid value for "best_of", must be smaller than or equal to 20.')
  end

  if !@best_of.nil? && @best_of < 0
    invalid_properties.push('invalid value for "best_of", must be greater than or equal to 0.')
  end

  invalid_properties
end