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



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
163
164
165
166
167
168
169
170
171
172
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 113

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

#description ⇒ Object

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

#instructions ⇒ Object

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

#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.



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

def 
  @metadata
end

#model ⇒ Object

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

#name ⇒ Object

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_format ⇒ Object

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

#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.



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

def temperature
  @temperature
end

#tool_resources ⇒ Object

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

#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.



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

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.



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_map ⇒ Object

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_attributes ⇒ Object

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

.acceptable_openapi_nullable ⇒ Object

Returns the nullable attributes



107
108
109
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 107

def self.acceptable_openapi_nullable
  openapi_nullable
end

.acceptable_openapi_types ⇒ Object

Returns attribute type mapping



102
103
104
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 102

def self.acceptable_openapi_types
  openapi_types
end

.attribute_map ⇒ Object

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



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 333

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  # include attributes inherited from allOf parents (the nearest declaration wins)
  map = acceptable_attribute_map
  transformed_hash = {}
  acceptable_openapi_types.each_pair do |key, type|
    if attributes.key?(map[key]) && attributes[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[map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullable ⇒ Object

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_types ⇒ Object

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



303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 303

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


320
321
322
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 320

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



326
327
328
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 326

def hash
  [model, name, description, 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?

Returns:

  • Array for valid properties with the reasons



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

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_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 357

def to_hash
  hash = {}
  # include attributes inherited from allOf parents (the nearest declaration wins)
  self.class.acceptable_attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.acceptable_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



216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/openapi_openai/models/modify_assistant_request.rb', line 216

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