Class: OpenApiOpenAIClient::CreateChatCompletionRequest
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- OpenApiOpenAIClient::CreateChatCompletionRequest
- Defined in:
- lib/openapi_openai/models/create_chat_completion_request.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#audio ⇒ Object
Returns the value of attribute audio.
-
#frequency_penalty ⇒ Object
Number between -2.0 and 2.0.
-
#function_call ⇒ Object
Returns the value of attribute function_call.
-
#functions ⇒ Object
Deprecated in favor of
tools. -
#logit_bias ⇒ Object
Modify the likelihood of specified tokens appearing in the completion.
-
#logprobs ⇒ Object
Whether to return log probabilities of the output tokens or not.
-
#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](/docs/guides/reasoning).
-
#max_tokens ⇒ Object
The maximum number of [tokens](/tokenizer) that can be generated in the chat completion.
-
#messages ⇒ Object
A list of messages comprising the conversation so far.
-
#metadata ⇒ Object
Developer-defined tags and values used for filtering completions in the [dashboard](platform.openai.com/chat-completions).
-
#modalities ⇒ Object
Output types that you would like the model to generate for this request.
-
#model ⇒ Object
Returns the value of attribute model.
-
#n ⇒ Object
How many chat completion choices to generate for each input message.
-
#parallel_tool_calls ⇒ Object
Whether to enable [parallel function calling](/docs/guides/function-calling#configuring-parallel-function-calling) during tool use.
-
#prediction ⇒ Object
Returns the value of attribute prediction.
-
#presence_penalty ⇒ Object
Number between -2.0 and 2.0.
-
#reasoning_effort ⇒ Object
**o1 models only** Constrains effort on reasoning for [reasoning models](platform.openai.com/docs/guides/reasoning).
-
#response_format ⇒ Object
Returns the value of attribute response_format.
-
#seed ⇒ Object
This feature is in Beta.
-
#service_tier ⇒ Object
Specifies the latency tier to use for processing the request.
-
#stop ⇒ Object
Returns the value of attribute stop.
-
#store ⇒ Object
Whether or not to store the output of this chat completion request for use in our [model distillation](/docs/guides/distillation) or [evals](/docs/guides/evals) products.
-
#stream ⇒ Object
If set, partial message deltas will be sent, like in ChatGPT.
-
#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_logprobs ⇒ Object
An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.
-
#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
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
Class Method Summary collapse
-
.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.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CreateChatCompletionRequest
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ CreateChatCompletionRequest
Initializes the object
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 324 325 326 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 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 231 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenApiOpenAIClient::CreateChatCompletionRequest` 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 `OpenApiOpenAIClient::CreateChatCompletionRequest`. 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?(:'messages') if (value = attributes[:'messages']).is_a?(Array) self. = value end else self. = nil end if attributes.key?(:'model') self.model = attributes[:'model'] else self.model = nil end if attributes.key?(:'store') self.store = attributes[:'store'] else self.store = false end if attributes.key?(:'reasoning_effort') self.reasoning_effort = attributes[:'reasoning_effort'] else self.reasoning_effort = 'medium' end if attributes.key?(:'metadata') if (value = attributes[:'metadata']).is_a?(Hash) self. = value end end if attributes.key?(:'frequency_penalty') self.frequency_penalty = attributes[:'frequency_penalty'] else self.frequency_penalty = 0 end if attributes.key?(:'logit_bias') if (value = attributes[:'logit_bias']).is_a?(Hash) self.logit_bias = value end end if attributes.key?(:'logprobs') self.logprobs = attributes[:'logprobs'] else self.logprobs = false end if attributes.key?(:'top_logprobs') self.top_logprobs = attributes[:'top_logprobs'] end if attributes.key?(:'max_tokens') self.max_tokens = attributes[:'max_tokens'] end if attributes.key?(:'max_completion_tokens') self.max_completion_tokens = attributes[:'max_completion_tokens'] end if attributes.key?(:'n') self.n = attributes[:'n'] else self.n = 1 end if attributes.key?(:'modalities') if (value = attributes[:'modalities']).is_a?(Array) self.modalities = value end end if attributes.key?(:'prediction') self.prediction = attributes[:'prediction'] end if attributes.key?(:'audio') self.audio = attributes[:'audio'] end if attributes.key?(:'presence_penalty') self.presence_penalty = attributes[:'presence_penalty'] else self.presence_penalty = 0 end if attributes.key?(:'response_format') self.response_format = attributes[:'response_format'] end if attributes.key?(:'seed') self.seed = attributes[:'seed'] end if attributes.key?(:'service_tier') self.service_tier = attributes[:'service_tier'] else self.service_tier = 'auto' end if attributes.key?(:'stop') self.stop = attributes[:'stop'] end if attributes.key?(:'stream') self.stream = attributes[:'stream'] else self.stream = false end if attributes.key?(:'stream_options') self. = attributes[:'stream_options'] end if attributes.key?(:'temperature') self.temperature = attributes[:'temperature'] else self.temperature = 1 end if attributes.key?(:'top_p') self.top_p = attributes[:'top_p'] else self.top_p = 1 end if attributes.key?(:'tools') if (value = attributes[:'tools']).is_a?(Array) self.tools = value end end if attributes.key?(:'tool_choice') self.tool_choice = attributes[:'tool_choice'] 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?(:'user') self.user = attributes[:'user'] end if attributes.key?(:'function_call') self.function_call = attributes[:'function_call'] end if attributes.key?(:'functions') if (value = attributes[:'functions']).is_a?(Array) self.functions = value end end end |
Instance Attribute Details
#audio ⇒ Object
Returns the value of attribute audio.
58 59 60 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 58 def audio @audio end |
#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.
33 34 35 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 33 def frequency_penalty @frequency_penalty end |
#function_call ⇒ Object
Returns the value of attribute function_call.
95 96 97 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 95 def function_call @function_call end |
#functions ⇒ Object
Deprecated in favor of tools. A list of functions the model may generate JSON inputs for.
98 99 100 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 98 def functions @functions end |
#logit_bias ⇒ Object
Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.
36 37 38 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 36 def logit_bias @logit_bias end |
#logprobs ⇒ Object
Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message.
39 40 41 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 39 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](/docs/guides/reasoning).
48 49 50 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 48 def max_completion_tokens @max_completion_tokens end |
#max_tokens ⇒ Object
The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. This value can be used to control [costs](openai.com/api/pricing/) for text generated via API. This value is now deprecated in favor of max_completion_tokens, and is not compatible with [o1 series models](/docs/guides/reasoning).
45 46 47 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 45 def max_tokens @max_tokens end |
#messages ⇒ Object
A list of messages comprising the conversation so far. Depending on the [model](/docs/models) you use, different message types (modalities) are supported, like [text](/docs/guides/text-generation), [images](/docs/guides/vision), and [audio](/docs/guides/audio).
19 20 21 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 19 def end |
#metadata ⇒ Object
Developer-defined tags and values used for filtering completions in the [dashboard](platform.openai.com/chat-completions).
30 31 32 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 30 def end |
#modalities ⇒ Object
Output types that you would like the model to generate for this request. Most models are capable of generating text, which is the default: ‘["text"]` The gpt-4o-audio-preview model can also be used to [generate audio](/docs/guides/audio). To request that this model generate both text and audio responses, you can use: `["text", "audio"]`
54 55 56 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 54 def modalities @modalities end |
#model ⇒ Object
Returns the value of attribute model.
21 22 23 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 21 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.
51 52 53 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 51 def n @n end |
#parallel_tool_calls ⇒ Object
Whether to enable [parallel function calling](/docs/guides/function-calling#configuring-parallel-function-calling) during tool use.
90 91 92 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 90 def parallel_tool_calls @parallel_tool_calls end |
#prediction ⇒ Object
Returns the value of attribute prediction.
56 57 58 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 56 def prediction @prediction 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.
61 62 63 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 61 def presence_penalty @presence_penalty end |
#reasoning_effort ⇒ Object
**o1 models only** Constrains effort on reasoning for [reasoning models](platform.openai.com/docs/guides/reasoning). Currently supported values are low, medium, and high. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
27 28 29 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 27 def reasoning_effort @reasoning_effort end |
#response_format ⇒ Object
Returns the value of attribute response_format.
63 64 65 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 63 def response_format @response_format end |
#seed ⇒ Object
This feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed, and you should refer to the system_fingerprint response parameter to monitor changes in the backend.
66 67 68 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 66 def seed @seed end |
#service_tier ⇒ Object
Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service: - If set to ‘auto’, and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted. - If set to ‘auto’, and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - If set to ‘default’, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - When not set, the default behavior is ‘auto’. When this parameter is set, the response body will include the service_tier utilized.
69 70 71 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 69 def service_tier @service_tier end |
#stop ⇒ Object
Returns the value of attribute stop.
71 72 73 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 71 def stop @stop end |
#store ⇒ Object
Whether or not to store the output of this chat completion request for use in our [model distillation](/docs/guides/distillation) or [evals](/docs/guides/evals) products.
24 25 26 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 24 def store @store end |
#stream ⇒ Object
If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a ‘data: [DONE]` message. [Example Python code](cookbook.openai.com/examples/how_to_stream_completions).
74 75 76 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 74 def stream @stream end |
#stream_options ⇒ Object
Returns the value of attribute stream_options.
76 77 78 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 76 def 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.
79 80 81 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 79 def temperature @temperature end |
#tool_choice ⇒ Object
Returns the value of attribute tool_choice.
87 88 89 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 87 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. A max of 128 functions are supported.
85 86 87 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 85 def tools @tools end |
#top_logprobs ⇒ Object
An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used.
42 43 44 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 42 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. We generally recommend altering this or temperature but not both.
82 83 84 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 82 def top_p @top_p end |
#user ⇒ Object
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
93 94 95 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 93 def user @user end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
159 160 161 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 159 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
164 165 166 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 164 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 123 def self.attribute_map { :'messages' => :'messages', :'model' => :'model', :'store' => :'store', :'reasoning_effort' => :'reasoning_effort', :'metadata' => :'metadata', :'frequency_penalty' => :'frequency_penalty', :'logit_bias' => :'logit_bias', :'logprobs' => :'logprobs', :'top_logprobs' => :'top_logprobs', :'max_tokens' => :'max_tokens', :'max_completion_tokens' => :'max_completion_tokens', :'n' => :'n', :'modalities' => :'modalities', :'prediction' => :'prediction', :'audio' => :'audio', :'presence_penalty' => :'presence_penalty', :'response_format' => :'response_format', :'seed' => :'seed', :'service_tier' => :'service_tier', :'stop' => :'stop', :'stream' => :'stream', :'stream_options' => :'stream_options', :'temperature' => :'temperature', :'top_p' => :'top_p', :'tools' => :'tools', :'tool_choice' => :'tool_choice', :'parallel_tool_calls' => :'parallel_tool_calls', :'user' => :'user', :'function_call' => :'function_call', :'functions' => :'functions' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 730 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
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 205 def self.openapi_nullable Set.new([ :'store', :'metadata', :'frequency_penalty', :'logit_bias', :'logprobs', :'top_logprobs', :'max_tokens', :'max_completion_tokens', :'n', :'modalities', :'prediction', :'audio', :'presence_penalty', :'seed', :'service_tier', :'stream', :'stream_options', :'temperature', :'top_p', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 169 def self.openapi_types { :'messages' => :'Array<ChatCompletionRequestMessage>', :'model' => :'CreateChatCompletionRequestModel', :'store' => :'Boolean', :'reasoning_effort' => :'String', :'metadata' => :'Hash<String, String>', :'frequency_penalty' => :'Float', :'logit_bias' => :'Hash<String, Integer>', :'logprobs' => :'Boolean', :'top_logprobs' => :'Integer', :'max_tokens' => :'Integer', :'max_completion_tokens' => :'Integer', :'n' => :'Integer', :'modalities' => :'Array<String>', :'prediction' => :'PredictionContent', :'audio' => :'CreateChatCompletionRequestAudio', :'presence_penalty' => :'Float', :'response_format' => :'CreateChatCompletionRequestResponseFormat', :'seed' => :'Integer', :'service_tier' => :'String', :'stop' => :'CreateChatCompletionRequestStop', :'stream' => :'Boolean', :'stream_options' => :'ChatCompletionStreamOptions', :'temperature' => :'Float', :'top_p' => :'Float', :'tools' => :'Array<ChatCompletionTool>', :'tool_choice' => :'ChatCompletionToolChoiceOption', :'parallel_tool_calls' => :'Boolean', :'user' => :'String', :'function_call' => :'CreateChatCompletionRequestFunctionCall', :'functions' => :'Array<ChatCompletionFunctions>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 680 def ==(o) return true if self.equal?(o) self.class == o.class && == o. && model == o.model && store == o.store && reasoning_effort == o.reasoning_effort && == o. && frequency_penalty == o.frequency_penalty && logit_bias == o.logit_bias && logprobs == o.logprobs && top_logprobs == o.top_logprobs && max_tokens == o.max_tokens && max_completion_tokens == o.max_completion_tokens && n == o.n && modalities == o.modalities && prediction == o.prediction && audio == o.audio && presence_penalty == o.presence_penalty && response_format == o.response_format && seed == o.seed && service_tier == o.service_tier && stop == o.stop && stream == o.stream && == o. && temperature == o.temperature && top_p == o.top_p && tools == o.tools && tool_choice == o.tool_choice && parallel_tool_calls == o.parallel_tool_calls && user == o.user && function_call == o.function_call && functions == o.functions end |
#eql?(o) ⇒ Boolean
717 718 719 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 717 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
723 724 725 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 723 def hash [, model, store, reasoning_effort, , frequency_penalty, logit_bias, logprobs, top_logprobs, max_tokens, max_completion_tokens, n, modalities, prediction, audio, presence_penalty, response_format, seed, service_tier, stop, stream, , temperature, top_p, tools, tool_choice, parallel_tool_calls, user, function_call, functions].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
406 407 408 409 410 411 412 413 414 415 416 417 418 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 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 406 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if .nil? invalid_properties.push('invalid value for "messages", messages cannot be nil.') end if .length < 1 invalid_properties.push('invalid value for "messages", number of items must be greater than or equal to 1.') end if @model.nil? invalid_properties.push('invalid value for "model", model cannot be nil.') 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 !@top_logprobs.nil? && @top_logprobs > 20 invalid_properties.push('invalid value for "top_logprobs", must be smaller than or equal to 20.') 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 !@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 !@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 !@seed.nil? && @seed > 9223372036854776000 invalid_properties.push('invalid value for "seed", must be smaller than or equal to 9223372036854776000.') end if !@seed.nil? && @seed < -9223372036854776000 invalid_properties.push('invalid value for "seed", must be greater than or equal to -9223372036854776000.') 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 !@functions.nil? && @functions.length > 128 invalid_properties.push('invalid value for "functions", number of items must be less than or equal to 128.') end if !@functions.nil? && @functions.length < 1 invalid_properties.push('invalid value for "functions", number of items must be greater than or equal to 1.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
752 753 754 755 756 757 758 759 760 761 762 763 764 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 752 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
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 515 516 |
# File 'lib/openapi_openai/models/create_chat_completion_request.rb', line 490 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if .nil? return false if .length < 1 return false if @model.nil? reasoning_effort_validator = EnumAttributeValidator.new('String', ["low", "medium", "high"]) return false unless reasoning_effort_validator.valid?(@reasoning_effort) 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 > 20 return false if !@top_logprobs.nil? && @top_logprobs < 0 return false if !@n.nil? && @n > 128 return false if !@n.nil? && @n < 1 return false if !@presence_penalty.nil? && @presence_penalty > 2 return false if !@presence_penalty.nil? && @presence_penalty < -2 return false if !@seed.nil? && @seed > 9223372036854776000 return false if !@seed.nil? && @seed < -9223372036854776000 service_tier_validator = EnumAttributeValidator.new('String', ["auto", "default"]) return false unless service_tier_validator.valid?(@service_tier) return false if !@temperature.nil? && @temperature > 2 return false if !@temperature.nil? && @temperature < 0 return false if !@top_p.nil? && @top_p > 1 return false if !@top_p.nil? && @top_p < 0 return false if !@functions.nil? && @functions.length > 128 return false if !@functions.nil? && @functions.length < 1 true end |