Class: OpenApiOpenAIClient::ModifyAssistantRequest

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/openapi_openai/models/modify_assistant_request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ ModifyAssistantRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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
157
158
159
160
161
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 102

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `OpenApiOpenAIClient::ModifyAssistantRequest` 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::ModifyAssistantRequest`. 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?(:'model')
    self.model = attributes[:'model']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'instructions')
    self.instructions = attributes[:'instructions']
  end

  if attributes.key?(:'tools')
    if (value = attributes[:'tools']).is_a?(Array)
      self.tools = value
    end
  end

  if attributes.key?(:'tool_resources')
    self.tool_resources = attributes[:'tool_resources']
  end

  if attributes.key?(:'metadata')
    self. = attributes[:'metadata']
  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

#descriptionObject

The description of the assistant. The maximum length is 512 characters.



24
25
26
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 24

def description
  @description
end

#instructionsObject

The system instructions that the assistant uses. The maximum length is 256,000 characters.



27
28
29
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 27

def instructions
  @instructions
end

#metadataObject

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.



35
36
37
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 35

def 
  
end

#modelObject

Returns the value of attribute model.



18
19
20
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 18

def model
  @model
end

#nameObject

The name of the assistant. The maximum length is 256 characters.



21
22
23
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 21

def name
  @name
end

#response_formatObject

Returns the value of attribute response_format.



43
44
45
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 43

def response_format
  @response_format
end

#temperatureObject

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.



38
39
40
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 38

def temperature
  @temperature
end

#tool_resourcesObject

Returns the value of attribute tool_resources.



32
33
34
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 32

def tool_resources
  @tool_resources
end

#toolsObject

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.



30
31
32
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 30

def tools
  @tools
end

#top_pObject

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.



41
42
43
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 41

def top_p
  @top_p
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



62
63
64
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 62

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



67
68
69
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 67

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 46

def self.attribute_map
  {
    :'model' => :'model',
    :'name' => :'name',
    :'description' => :'description',
    :'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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 322

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_nullableObject

List of attributes with nullable: true



88
89
90
91
92
93
94
95
96
97
98
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 88

def self.openapi_nullable
  Set.new([
    :'name',
    :'description',
    :'instructions',
    :'tool_resources',
    :'metadata',
    :'temperature',
    :'top_p',
  ])
end

.openapi_typesObject

Attribute type mapping.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 72

def self.openapi_types
  {
    :'model' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'instructions' => :'String',
    :'tools' => :'Array<AssistantObjectToolsInner>',
    :'tool_resources' => :'ModifyAssistantRequestToolResources',
    :'metadata' => :'Object',
    :'temperature' => :'Float',
    :'top_p' => :'Float',
    :'response_format' => :'AssistantsApiResponseFormatOption'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 292

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      model == o.model &&
      name == o.name &&
      description == o.description &&
      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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


309
310
311
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 309

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



315
316
317
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 315

def hash
  [model, name, description, instructions, tools, tool_resources, , temperature, top_p, response_format].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 165

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@name.nil? && @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.nil? && @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 !@instructions.nil? && @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? && @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_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 344

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

Returns:

  • (Boolean)

    true if the model is valid



205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 205

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@name.nil? && @name.to_s.length > 256
  return false if !@description.nil? && @description.to_s.length > 512
  return false if !@instructions.nil? && @instructions.to_s.length > 256000
  return false if !@tools.nil? && @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