Class: OpenApiOpenAIClient::AssistantObject
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- OpenApiOpenAIClient::AssistantObject
- Defined in:
- lib/openapi_openai/models/assistant_object.rb
Overview
Represents an assistant that can call the model and use tools.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#created_at ⇒ Object
The Unix timestamp (in seconds) for when the assistant was created.
-
#description ⇒ Object
The description of the assistant.
-
#id ⇒ Object
The identifier, which can be referenced in API endpoints.
-
#instructions ⇒ Object
The system instructions that the assistant uses.
-
#metadata ⇒ Object
Set of 16 key-value pairs that can be attached to an object.
-
#model ⇒ Object
ID of the model to use.
-
#name ⇒ Object
The name of the assistant.
-
#object ⇒ Object
The object type, which is always
assistant. -
#response_format ⇒ Object
Returns the value of attribute response_format.
-
#temperature ⇒ Object
What sampling temperature to use, between 0 and 2.
-
#tool_resources ⇒ Object
Returns the value of attribute tool_resources.
-
#tools ⇒ Object
A list of tool enabled on the assistant.
-
#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.
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 = {}) ⇒ AssistantObject
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 = {}) ⇒ AssistantObject
Initializes the object
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 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 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 141 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenApiOpenAIClient::AssistantObject` 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::AssistantObject`. 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?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'object') self.object = attributes[:'object'] else self.object = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] else self.created_at = nil end if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = nil end if attributes.key?(:'description') self.description = attributes[:'description'] else self.description = nil end if attributes.key?(:'model') self.model = attributes[:'model'] else self.model = nil end if attributes.key?(:'instructions') self.instructions = attributes[:'instructions'] else self.instructions = nil end if attributes.key?(:'tools') if (value = attributes[:'tools']).is_a?(Array) self.tools = value end else self.tools = nil end if attributes.key?(:'tool_resources') self.tool_resources = attributes[:'tool_resources'] end if attributes.key?(:'metadata') self. = attributes[:'metadata'] else self. = nil 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?(:'response_format') self.response_format = attributes[:'response_format'] end end |
Instance Attribute Details
#created_at ⇒ Object
The Unix timestamp (in seconds) for when the assistant was created.
26 27 28 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 26 def created_at @created_at end |
#description ⇒ Object
The description of the assistant. The maximum length is 512 characters.
32 33 34 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 32 def description @description end |
#id ⇒ Object
The identifier, which can be referenced in API endpoints.
20 21 22 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 20 def id @id end |
#instructions ⇒ Object
The system instructions that the assistant uses. The maximum length is 256,000 characters.
38 39 40 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 38 def instructions @instructions 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.
46 47 48 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 46 def @metadata end |
#model ⇒ Object
ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them.
35 36 37 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 35 def model @model end |
#name ⇒ Object
The name of the assistant. The maximum length is 256 characters.
29 30 31 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 29 def name @name end |
#object ⇒ Object
The object type, which is always assistant.
23 24 25 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 23 def object @object end |
#response_format ⇒ Object
Returns the value of attribute response_format.
54 55 56 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 54 def response_format @response_format 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.
49 50 51 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 49 def temperature @temperature end |
#tool_resources ⇒ Object
Returns the value of attribute tool_resources.
43 44 45 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 43 def tool_resources @tool_resources end |
#tools ⇒ Object
A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types code_interpreter, file_search, or function.
41 42 43 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 41 def tools @tools 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.
52 53 54 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 52 def top_p @top_p end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
98 99 100 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 98 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
103 104 105 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 103 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 79 def self.attribute_map { :'id' => :'id', :'object' => :'object', :'created_at' => :'created_at', :'name' => :'name', :'description' => :'description', :'model' => :'model', :'instructions' => :'instructions', :'tools' => :'tools', :'tool_resources' => :'tool_resources', :'metadata' => :'metadata', :'temperature' => :'temperature', :'top_p' => :'top_p', :'response_format' => :'response_format' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 461 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
127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 127 def self.openapi_nullable Set.new([ :'name', :'description', :'instructions', :'tool_resources', :'metadata', :'temperature', :'top_p', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 108 def self.openapi_types { :'id' => :'String', :'object' => :'String', :'created_at' => :'Integer', :'name' => :'String', :'description' => :'String', :'model' => :'String', :'instructions' => :'String', :'tools' => :'Array<AssistantObjectToolsInner>', :'tool_resources' => :'AssistantObjectToolResources', :'metadata' => :'Object', :'temperature' => :'Float', :'top_p' => :'Float', :'response_format' => :'AssistantsApiResponseFormatOption' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 428 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && object == o.object && created_at == o.created_at && name == o.name && description == o.description && model == o.model && instructions == o.instructions && tools == o.tools && tool_resources == o.tool_resources && == o. && temperature == o.temperature && top_p == o.top_p && response_format == o.response_format end |
#eql?(o) ⇒ Boolean
448 449 450 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 448 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
454 455 456 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 454 def hash [id, object, created_at, name, description, model, instructions, tools, tool_resources, , temperature, top_p, response_format].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 234 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @object.nil? invalid_properties.push('invalid value for "object", object cannot be nil.') end if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @name.to_s.length > 256 invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 256.') end if @description.to_s.length > 512 invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 512.') end if @model.nil? invalid_properties.push('invalid value for "model", model cannot be nil.') end if @instructions.to_s.length > 256000 invalid_properties.push('invalid value for "instructions", the character length must be smaller than or equal to 256000.') end if @tools.nil? invalid_properties.push('invalid value for "tools", tools cannot be nil.') end if @tools.length > 128 invalid_properties.push('invalid value for "tools", number of items must be less than or equal to 128.') 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 invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
483 484 485 486 487 488 489 490 491 492 493 494 495 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 483 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
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/openapi_openai/models/assistant_object.rb', line 294 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["assistant"]) return false unless object_validator.valid?(@object) return false if @created_at.nil? return false if @name.to_s.length > 256 return false if @description.to_s.length > 512 return false if @model.nil? return false if @instructions.to_s.length > 256000 return false if @tools.nil? return false if @tools.length > 128 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 true end |