Class: OpenApiOpenAIClient::RealtimeResponseCreateParams
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- OpenApiOpenAIClient::RealtimeResponseCreateParams
- Defined in:
- lib/openapi_openai/models/realtime_response_create_params.rb
Overview
Create a new Realtime response with these parameters
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#conversation ⇒ Object
Returns the value of attribute conversation.
-
#input ⇒ Object
Input items to include in the prompt for the model.
-
#instructions ⇒ Object
The default system instructions (i.e. system message) prepended to model calls.
-
#max_response_output_tokens ⇒ Object
Returns the value of attribute max_response_output_tokens.
-
#metadata ⇒ Object
Set of 16 key-value pairs that can be attached to an object.
-
#modalities ⇒ Object
The set of modalities the model can respond with.
-
#output_audio_format ⇒ Object
The format of output audio.
-
#temperature ⇒ Object
Sampling temperature for the model, limited to [0.6, 1.2].
-
#tool_choice ⇒ Object
How the model chooses tools.
-
#tools ⇒ Object
Tools (functions) available to the model.
-
#voice ⇒ Object
The voice the model uses to respond.
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 = {}) ⇒ RealtimeResponseCreateParams
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 = {}) ⇒ RealtimeResponseCreateParams
Initializes the object
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 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 125 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenApiOpenAIClient::RealtimeResponseCreateParams` 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::RealtimeResponseCreateParams`. 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?(:'modalities') if (value = attributes[:'modalities']).is_a?(Array) self.modalities = value end end if attributes.key?(:'instructions') self.instructions = attributes[:'instructions'] end if attributes.key?(:'voice') self.voice = attributes[:'voice'] end if attributes.key?(:'output_audio_format') self.output_audio_format = attributes[:'output_audio_format'] 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?(:'temperature') self.temperature = attributes[:'temperature'] end if attributes.key?(:'max_response_output_tokens') self.max_response_output_tokens = attributes[:'max_response_output_tokens'] end if attributes.key?(:'conversation') self.conversation = attributes[:'conversation'] end if attributes.key?(:'metadata') self. = attributes[:'metadata'] end if attributes.key?(:'input') if (value = attributes[:'input']).is_a?(Array) self.input = value end end end |
Instance Attribute Details
#conversation ⇒ Object
Returns the value of attribute conversation.
42 43 44 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 42 def conversation @conversation end |
#input ⇒ Object
Input items to include in the prompt for the model. Creates a new context for this response, without including the default conversation. Can include references to items from the default conversation.
48 49 50 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 48 def input @input end |
#instructions ⇒ Object
The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. Note that the server sets default instructions which will be used if this field is not set and are visible in the session.created event at the start of the session.
23 24 25 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 23 def instructions @instructions end |
#max_response_output_tokens ⇒ Object
Returns the value of attribute max_response_output_tokens.
40 41 42 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 40 def max_response_output_tokens @max_response_output_tokens end |
#metadata ⇒ Object
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
45 46 47 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 45 def @metadata end |
#modalities ⇒ Object
The set of modalities the model can respond with. To disable audio, set this to ["text"].
20 21 22 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 20 def modalities @modalities end |
#output_audio_format ⇒ Object
The format of output audio. Options are pcm16, g711_ulaw, or g711_alaw.
29 30 31 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 29 def output_audio_format @output_audio_format end |
#temperature ⇒ Object
Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.
38 39 40 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 38 def temperature @temperature end |
#tool_choice ⇒ Object
How the model chooses tools. Options are auto, none, required, or specify a function, like ‘"function", "function": {"name": "my_function"}`.
35 36 37 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 35 def tool_choice @tool_choice end |
#tools ⇒ Object
Tools (functions) available to the model.
32 33 34 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 32 def tools @tools end |
#voice ⇒ Object
The voice the model uses to respond. Voice cannot be changed during the session once the model has responded with audio at least once. Current voice options are alloy, ash, ballad, coral, echo sage, shimmer and verse.
26 27 28 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 26 def voice @voice end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
90 91 92 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 90 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
95 96 97 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 95 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 73 def self.attribute_map { :'modalities' => :'modalities', :'instructions' => :'instructions', :'voice' => :'voice', :'output_audio_format' => :'output_audio_format', :'tools' => :'tools', :'tool_choice' => :'tool_choice', :'temperature' => :'temperature', :'max_response_output_tokens' => :'max_response_output_tokens', :'conversation' => :'conversation', :'metadata' => :'metadata', :'input' => :'input' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 262 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
117 118 119 120 121 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 117 def self.openapi_nullable Set.new([ :'metadata', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 100 def self.openapi_types { :'modalities' => :'Array<String>', :'instructions' => :'String', :'voice' => :'String', :'output_audio_format' => :'String', :'tools' => :'Array<RealtimeResponseCreateParamsToolsInner>', :'tool_choice' => :'String', :'temperature' => :'Float', :'max_response_output_tokens' => :'RealtimeResponseCreateParamsMaxResponseOutputTokens', :'conversation' => :'RealtimeResponseCreateParamsConversation', :'metadata' => :'Object', :'input' => :'Array<RealtimeConversationItem>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 231 def ==(o) return true if self.equal?(o) self.class == o.class && modalities == o.modalities && instructions == o.instructions && voice == o.voice && output_audio_format == o.output_audio_format && tools == o.tools && tool_choice == o.tool_choice && temperature == o.temperature && max_response_output_tokens == o.max_response_output_tokens && conversation == o.conversation && == o. && input == o.input end |
#eql?(o) ⇒ Boolean
249 250 251 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 249 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
255 256 257 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 255 def hash [modalities, instructions, voice, output_audio_format, tools, tool_choice, temperature, max_response_output_tokens, conversation, , input].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
192 193 194 195 196 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 192 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 284 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
200 201 202 203 204 205 206 207 |
# File 'lib/openapi_openai/models/realtime_response_create_params.rb', line 200 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' voice_validator = EnumAttributeValidator.new('String', ["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse"]) return false unless voice_validator.valid?(@voice) output_audio_format_validator = EnumAttributeValidator.new('String', ["pcm16", "g711_ulaw", "g711_alaw"]) return false unless output_audio_format_validator.valid?(@output_audio_format) true end |