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



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

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.



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

def description
  @description
end

#instructionsObject

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



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

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.



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

def 
  @metadata
end

#modelObject

ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.



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

def model
  @model
end

#nameObject

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



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

def name
  @name
end

#response_formatObject

Returns the value of attribute response_format.



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

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.



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

def temperature
  @temperature
end

#tool_resourcesObject

Returns the value of attribute tool_resources.



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

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.



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

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.



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

def top_p
  @top_p
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



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

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

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



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

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



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

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

.openapi_typesObject

Attribute type mapping.



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

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



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

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


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

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



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

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



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

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



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

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



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

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