Class: VeniceClient::ChatCompletionRequest
- Inherits:
-
Object
- Object
- VeniceClient::ChatCompletionRequest
- Defined in:
- lib/venice_client/models/chat_completion_request.rb
Instance Attribute Summary collapse
-
#frequency_penalty ⇒ Object
Number between -2.0 and 2.0.
-
#logprobs ⇒ Object
Whether to include log probabilities in the response.
-
#max_completion_tokens ⇒ Object
An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
-
#max_temp ⇒ Object
Maximum temperature value for dynamic temperature scaling.
-
#max_tokens ⇒ Object
The maximum number of tokens that can be generated in the chat completion.
-
#messages ⇒ Object
A list of messages comprising the conversation so far.
-
#min_p ⇒ Object
Sets a minimum probability threshold for token selection.
-
#min_temp ⇒ Object
Minimum temperature value for dynamic temperature scaling.
-
#model ⇒ Object
The ID of the model you wish to prompt.
-
#n ⇒ Object
How many chat completion choices to generate for each input message.
-
#parallel_tool_calls ⇒ Object
Whether to enable parallel function calling during tool use.
-
#presence_penalty ⇒ Object
Number between -2.0 and 2.0.
-
#repetition_penalty ⇒ Object
The parameter for repetition penalty.
-
#response_format ⇒ Object
Returns the value of attribute response_format.
-
#seed ⇒ Object
The random seed used to generate the response.
-
#stop ⇒ Object
Returns the value of attribute stop.
-
#stop_token_ids ⇒ Object
Array of token IDs where the API will stop generating further tokens.
-
#stream ⇒ Object
Whether to stream back partial progress.
-
#stream_options ⇒ Object
Returns the value of attribute stream_options.
-
#temperature ⇒ Object
What sampling temperature to use, between 0 and 2.
-
#tool_choice ⇒ Object
Returns the value of attribute tool_choice.
-
#tools ⇒ Object
A list of tools the model may call.
-
#top_k ⇒ Object
The number of highest probability vocabulary tokens to keep for top-k-filtering.
-
#top_logprobs ⇒ Object
The number of highest probability tokens to return for each token position.
-
#top_p ⇒ Object
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
-
#user ⇒ Object
This field is discarded on the request but is supported in the Venice API for compatibility with OpenAI clients.
-
#venice_parameters ⇒ Object
Returns the value of attribute venice_parameters.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ChatCompletionRequest
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ ChatCompletionRequest
Initializes the object
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 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 180 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `VeniceClient::ChatCompletionRequest` 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 `VeniceClient::ChatCompletionRequest`. 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?(:'frequency_penalty') self.frequency_penalty = attributes[:'frequency_penalty'] else self.frequency_penalty = 0 end if attributes.key?(:'logprobs') self.logprobs = attributes[:'logprobs'] end if attributes.key?(:'top_logprobs') self.top_logprobs = attributes[:'top_logprobs'] end if attributes.key?(:'max_completion_tokens') self.max_completion_tokens = attributes[:'max_completion_tokens'] end if attributes.key?(:'max_temp') self.max_temp = attributes[:'max_temp'] end if attributes.key?(:'max_tokens') self.max_tokens = attributes[:'max_tokens'] end if attributes.key?(:'messages') if (value = attributes[:'messages']).is_a?(Array) self. = value end else self. = nil end if attributes.key?(:'min_p') self.min_p = attributes[:'min_p'] end if attributes.key?(:'min_temp') self.min_temp = attributes[:'min_temp'] end if attributes.key?(:'model') self.model = attributes[:'model'] else self.model = nil end if attributes.key?(:'n') self.n = attributes[:'n'] else self.n = 1 end if attributes.key?(:'presence_penalty') self.presence_penalty = attributes[:'presence_penalty'] else self.presence_penalty = 0 end if attributes.key?(:'repetition_penalty') self.repetition_penalty = attributes[:'repetition_penalty'] end if attributes.key?(:'seed') self.seed = attributes[:'seed'] end if attributes.key?(:'stop') self.stop = attributes[:'stop'] end if attributes.key?(:'stop_token_ids') if (value = attributes[:'stop_token_ids']).is_a?(Array) self.stop_token_ids = value end end if attributes.key?(:'stream') self.stream = attributes[:'stream'] end if attributes.key?(:'stream_options') self. = attributes[:'stream_options'] end if attributes.key?(:'temperature') self.temperature = attributes[:'temperature'] else self.temperature = 0.7 end if attributes.key?(:'top_k') self.top_k = attributes[:'top_k'] end if attributes.key?(:'top_p') self.top_p = attributes[:'top_p'] else self.top_p = 0.9 end if attributes.key?(:'user') self.user = attributes[:'user'] end if attributes.key?(:'venice_parameters') self.venice_parameters = attributes[:'venice_parameters'] end if attributes.key?(:'parallel_tool_calls') self.parallel_tool_calls = attributes[:'parallel_tool_calls'] else self.parallel_tool_calls = true end if attributes.key?(:'response_format') self.response_format = attributes[:'response_format'] end if attributes.key?(:'tool_choice') self.tool_choice = attributes[:'tool_choice'] end if attributes.key?(:'tools') if (value = attributes[:'tools']).is_a?(Array) self.tools = value end end end |
Instance Attribute Details
#frequency_penalty ⇒ Object
Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model’s likelihood to repeat the same line verbatim.
19 20 21 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 19 def frequency_penalty @frequency_penalty end |
#logprobs ⇒ Object
Whether to include log probabilities in the response. This is not supported by all models.
22 23 24 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 22 def logprobs @logprobs end |
#max_completion_tokens ⇒ Object
An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
28 29 30 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 28 def max_completion_tokens @max_completion_tokens end |
#max_temp ⇒ Object
Maximum temperature value for dynamic temperature scaling.
31 32 33 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 31 def max_temp @max_temp end |
#max_tokens ⇒ Object
The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API. This value is now deprecated in favor of max_completion_tokens.
34 35 36 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 34 def max_tokens @max_tokens end |
#messages ⇒ Object
A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text and images. For compatibility purposes, the schema supports submitting multiple image_url messages, however, only the last image_url message will be passed to and processed by the model.
37 38 39 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 37 def @messages end |
#min_p ⇒ Object
Sets a minimum probability threshold for token selection. Tokens with probabilities below this value are filtered out.
40 41 42 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 40 def min_p @min_p end |
#min_temp ⇒ Object
Minimum temperature value for dynamic temperature scaling.
43 44 45 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 43 def min_temp @min_temp end |
#model ⇒ Object
The ID of the model you wish to prompt. May also be a model trait, or a model compatibility mapping. See the models endpoint for a list of models available to you. You can use feature suffixes to enable features from the venice_parameters object. Please see "Model Feature Suffix" documentation for more details.
46 47 48 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 46 def model @model end |
#n ⇒ Object
How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs.
49 50 51 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 49 def n @n end |
#parallel_tool_calls ⇒ Object
Whether to enable parallel function calling during tool use.
85 86 87 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 85 def parallel_tool_calls @parallel_tool_calls end |
#presence_penalty ⇒ Object
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model’s likelihood to talk about new topics.
52 53 54 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 52 def presence_penalty @presence_penalty end |
#repetition_penalty ⇒ Object
The parameter for repetition penalty. 1.0 means no penalty. Values > 1.0 discourage repetition.
55 56 57 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 55 def repetition_penalty @repetition_penalty end |
#response_format ⇒ Object
Returns the value of attribute response_format.
87 88 89 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 87 def response_format @response_format end |
#seed ⇒ Object
The random seed used to generate the response. This is useful for reproducibility.
58 59 60 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 58 def seed @seed end |
#stop ⇒ Object
Returns the value of attribute stop.
60 61 62 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 60 def stop @stop end |
#stop_token_ids ⇒ Object
Array of token IDs where the API will stop generating further tokens.
63 64 65 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 63 def stop_token_ids @stop_token_ids end |
#stream ⇒ Object
Whether to stream back partial progress. Defaults to false.
66 67 68 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 66 def stream @stream end |
#stream_options ⇒ Object
Returns the value of attribute stream_options.
68 69 70 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 68 def @stream_options end |
#temperature ⇒ Object
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.
71 72 73 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 71 def temperature @temperature end |
#tool_choice ⇒ Object
Returns the value of attribute tool_choice.
89 90 91 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 89 def tool_choice @tool_choice end |
#tools ⇒ Object
A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for.
92 93 94 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 92 def tools @tools end |
#top_k ⇒ Object
The number of highest probability vocabulary tokens to keep for top-k-filtering.
74 75 76 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 74 def top_k @top_k end |
#top_logprobs ⇒ Object
The number of highest probability tokens to return for each token position.
25 26 27 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 25 def top_logprobs @top_logprobs end |
#top_p ⇒ Object
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
77 78 79 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 77 def top_p @top_p end |
#user ⇒ Object
This field is discarded on the request but is supported in the Venice API for compatibility with OpenAI clients.
80 81 82 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 80 def user @user end |
#venice_parameters ⇒ Object
Returns the value of attribute venice_parameters.
82 83 84 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 82 def venice_parameters @venice_parameters end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 724 def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = VeniceClient.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
128 129 130 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 128 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
133 134 135 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 133 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
95 96 97 98 99 100 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 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 95 def self.attribute_map { :'frequency_penalty' => :'frequency_penalty', :'logprobs' => :'logprobs', :'top_logprobs' => :'top_logprobs', :'max_completion_tokens' => :'max_completion_tokens', :'max_temp' => :'max_temp', :'max_tokens' => :'max_tokens', :'messages' => :'messages', :'min_p' => :'min_p', :'min_temp' => :'min_temp', :'model' => :'model', :'n' => :'n', :'presence_penalty' => :'presence_penalty', :'repetition_penalty' => :'repetition_penalty', :'seed' => :'seed', :'stop' => :'stop', :'stop_token_ids' => :'stop_token_ids', :'stream' => :'stream', :'stream_options' => :'stream_options', :'temperature' => :'temperature', :'top_k' => :'top_k', :'top_p' => :'top_p', :'user' => :'user', :'venice_parameters' => :'venice_parameters', :'parallel_tool_calls' => :'parallel_tool_calls', :'response_format' => :'response_format', :'tool_choice' => :'tool_choice', :'tools' => :'tools' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 700 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_nullable ⇒ Object
List of attributes with nullable: true
171 172 173 174 175 176 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 171 def self.openapi_nullable Set.new([ :'stop', :'tools' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 138 def self.openapi_types { :'frequency_penalty' => :'Float', :'logprobs' => :'Boolean', :'top_logprobs' => :'Integer', :'max_completion_tokens' => :'Integer', :'max_temp' => :'Float', :'max_tokens' => :'Integer', :'messages' => :'Array<ChatCompletionRequestMessagesInner>', :'min_p' => :'Float', :'min_temp' => :'Float', :'model' => :'String', :'n' => :'Integer', :'presence_penalty' => :'Float', :'repetition_penalty' => :'Float', :'seed' => :'Integer', :'stop' => :'ChatCompletionRequestStop', :'stop_token_ids' => :'Array<Float>', :'stream' => :'Boolean', :'stream_options' => :'ChatCompletionRequestStreamOptions', :'temperature' => :'Float', :'top_k' => :'Integer', :'top_p' => :'Float', :'user' => :'String', :'venice_parameters' => :'ChatCompletionRequestVeniceParameters', :'parallel_tool_calls' => :'Boolean', :'response_format' => :'ChatCompletionRequestResponseFormat', :'tool_choice' => :'ChatCompletionRequestToolChoice', :'tools' => :'Array<ToolCall>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 653 def ==(o) return true if self.equal?(o) self.class == o.class && frequency_penalty == o.frequency_penalty && logprobs == o.logprobs && top_logprobs == o.top_logprobs && max_completion_tokens == o.max_completion_tokens && max_temp == o.max_temp && max_tokens == o.max_tokens && == o. && min_p == o.min_p && min_temp == o.min_temp && model == o.model && n == o.n && presence_penalty == o.presence_penalty && repetition_penalty == o.repetition_penalty && seed == o.seed && stop == o.stop && stop_token_ids == o.stop_token_ids && stream == o.stream && == o. && temperature == o.temperature && top_k == o.top_k && top_p == o.top_p && user == o.user && venice_parameters == o.venice_parameters && parallel_tool_calls == o.parallel_tool_calls && response_format == o.response_format && tool_choice == o.tool_choice && tools == o.tools end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
795 796 797 798 799 800 801 802 803 804 805 806 807 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 795 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#eql?(o) ⇒ Boolean
687 688 689 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 687 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
693 694 695 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 693 def hash [frequency_penalty, logprobs, top_logprobs, max_completion_tokens, max_temp, max_tokens, , min_p, min_temp, model, n, presence_penalty, repetition_penalty, seed, stop, stop_token_ids, stream, , temperature, top_k, top_p, user, venice_parameters, parallel_tool_calls, response_format, tool_choice, tools].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 327 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new 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 !@top_logprobs.nil? && @top_logprobs < 0 invalid_properties.push('invalid value for "top_logprobs", must be greater than or equal to 0.') end if !@max_temp.nil? && @max_temp > 2 invalid_properties.push('invalid value for "max_temp", must be smaller than or equal to 2.') end if !@max_temp.nil? && @max_temp < 0 invalid_properties.push('invalid value for "max_temp", must be greater than or equal to 0.') end if @messages.nil? invalid_properties.push('invalid value for "messages", messages cannot be nil.') end if @messages.length < 1 invalid_properties.push('invalid value for "messages", number of items must be greater than or equal to 1.') end if !@min_p.nil? && @min_p > 1 invalid_properties.push('invalid value for "min_p", must be smaller than or equal to 1.') end if !@min_p.nil? && @min_p < 0 invalid_properties.push('invalid value for "min_p", must be greater than or equal to 0.') end if !@min_temp.nil? && @min_temp > 2 invalid_properties.push('invalid value for "min_temp", must be smaller than or equal to 2.') end if !@min_temp.nil? && @min_temp < 0 invalid_properties.push('invalid value for "min_temp", must be greater than or equal to 0.') end if @model.nil? invalid_properties.push('invalid value for "model", model cannot be nil.') 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 !@repetition_penalty.nil? && @repetition_penalty < 0 invalid_properties.push('invalid value for "repetition_penalty", must be greater than or equal to 0.') end if !@seed.nil? && @seed <= 0 invalid_properties.push('invalid value for "seed", must be greater than 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_k.nil? && @top_k < 0 invalid_properties.push('invalid value for "top_k", 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 invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
771 772 773 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 771 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
777 778 779 780 781 782 783 784 785 786 787 788 789 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 777 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 |
#to_s ⇒ String
Returns the string representation of the object
765 766 767 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 765 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/venice_client/models/chat_completion_request.rb', line 419 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@frequency_penalty.nil? && @frequency_penalty > 2 return false if !@frequency_penalty.nil? && @frequency_penalty < -2 return false if !@top_logprobs.nil? && @top_logprobs < 0 return false if !@max_temp.nil? && @max_temp > 2 return false if !@max_temp.nil? && @max_temp < 0 return false if @messages.nil? return false if @messages.length < 1 return false if !@min_p.nil? && @min_p > 1 return false if !@min_p.nil? && @min_p < 0 return false if !@min_temp.nil? && @min_temp > 2 return false if !@min_temp.nil? && @min_temp < 0 return false if @model.nil? return false if !@presence_penalty.nil? && @presence_penalty > 2 return false if !@presence_penalty.nil? && @presence_penalty < -2 return false if !@repetition_penalty.nil? && @repetition_penalty < 0 return false if !@seed.nil? && @seed <= 0 return false if !@temperature.nil? && @temperature > 2 return false if !@temperature.nil? && @temperature < 0 return false if !@top_k.nil? && @top_k < 0 return false if !@top_p.nil? && @top_p > 1 return false if !@top_p.nil? && @top_p < 0 true end |