openapi_openai 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +72 -0
- data/README.md +171 -0
- data/Rakefile +10 -0
- data/bin/bundle +109 -0
- data/bin/byebug +27 -0
- data/bin/coderay +27 -0
- data/bin/htmldiff +27 -0
- data/bin/ldiff +27 -0
- data/bin/pry +27 -0
- data/bin/racc +27 -0
- data/bin/rake +27 -0
- data/bin/rspec +27 -0
- data/bin/rubocop +27 -0
- data/bin/ruby-parse +27 -0
- data/bin/ruby-rewrite +27 -0
- data/docs/ChatCompletionFunctions.md +22 -0
- data/docs/ChatCompletionRequestMessage.md +24 -0
- data/docs/ChatCompletionRequestMessageFunctionCall.md +20 -0
- data/docs/ChatCompletionResponseMessage.md +22 -0
- data/docs/ChatCompletionStreamResponseDelta.md +22 -0
- data/docs/CreateChatCompletionRequest.md +44 -0
- data/docs/CreateChatCompletionRequestFunctionCall.md +49 -0
- data/docs/CreateChatCompletionRequestFunctionCallOneOf.md +18 -0
- data/docs/CreateChatCompletionRequestModel.md +47 -0
- data/docs/CreateChatCompletionRequestStop.md +49 -0
- data/docs/CreateChatCompletionResponse.md +28 -0
- data/docs/CreateChatCompletionResponseChoicesInner.md +22 -0
- data/docs/CreateChatCompletionStreamResponse.md +26 -0
- data/docs/CreateChatCompletionStreamResponseChoicesInner.md +22 -0
- data/docs/CreateCompletionRequest.md +48 -0
- data/docs/CreateCompletionRequestModel.md +47 -0
- data/docs/CreateCompletionRequestPrompt.md +53 -0
- data/docs/CreateCompletionRequestStop.md +49 -0
- data/docs/CreateCompletionResponse.md +28 -0
- data/docs/CreateCompletionResponseChoicesInner.md +24 -0
- data/docs/CreateCompletionResponseChoicesInnerLogprobs.md +24 -0
- data/docs/CreateCompletionResponseUsage.md +22 -0
- data/docs/CreateEditRequest.md +28 -0
- data/docs/CreateEditRequestModel.md +47 -0
- data/docs/CreateEditResponse.md +24 -0
- data/docs/CreateEditResponseChoicesInner.md +24 -0
- data/docs/CreateEmbeddingRequest.md +22 -0
- data/docs/CreateEmbeddingRequestInput.md +53 -0
- data/docs/CreateEmbeddingRequestModel.md +47 -0
- data/docs/CreateEmbeddingResponse.md +24 -0
- data/docs/CreateEmbeddingResponseDataInner.md +22 -0
- data/docs/CreateEmbeddingResponseUsage.md +20 -0
- data/docs/CreateFineTuneRequest.md +40 -0
- data/docs/CreateFineTuneRequestModel.md +47 -0
- data/docs/CreateImageRequest.md +26 -0
- data/docs/CreateModerationRequest.md +20 -0
- data/docs/CreateModerationRequestInput.md +49 -0
- data/docs/CreateModerationRequestModel.md +47 -0
- data/docs/CreateModerationResponse.md +22 -0
- data/docs/CreateModerationResponseResultsInner.md +22 -0
- data/docs/CreateModerationResponseResultsInnerCategories.md +30 -0
- data/docs/CreateModerationResponseResultsInnerCategoryScores.md +30 -0
- data/docs/CreateTranscriptionRequestModel.md +47 -0
- data/docs/CreateTranscriptionResponse.md +18 -0
- data/docs/CreateTranslationResponse.md +18 -0
- data/docs/DeleteFileResponse.md +22 -0
- data/docs/DeleteModelResponse.md +22 -0
- data/docs/Error.md +24 -0
- data/docs/ErrorResponse.md +18 -0
- data/docs/FineTune.md +42 -0
- data/docs/FineTuneEvent.md +24 -0
- data/docs/ImagesResponse.md +20 -0
- data/docs/ImagesResponseDataInner.md +20 -0
- data/docs/ListFilesResponse.md +20 -0
- data/docs/ListFineTuneEventsResponse.md +20 -0
- data/docs/ListFineTunesResponse.md +20 -0
- data/docs/ListModelsResponse.md +20 -0
- data/docs/Model.md +24 -0
- data/docs/OpenAIApi.md +1499 -0
- data/docs/OpenAIFile.md +32 -0
- data/git_push.sh +57 -0
- data/lib/openapi_openai/api/open_ai_api.rb +1583 -0
- data/lib/openapi_openai/api_client.rb +393 -0
- data/lib/openapi_openai/api_error.rb +58 -0
- data/lib/openapi_openai/configuration.rb +291 -0
- data/lib/openapi_openai/models/chat_completion_functions.rb +244 -0
- data/lib/openapi_openai/models/chat_completion_request_message.rb +285 -0
- data/lib/openapi_openai/models/chat_completion_request_message_function_call.rb +226 -0
- data/lib/openapi_openai/models/chat_completion_response_message.rb +276 -0
- data/lib/openapi_openai/models/chat_completion_stream_response_delta.rb +269 -0
- data/lib/openapi_openai/models/create_chat_completion_request.rb +537 -0
- data/lib/openapi_openai/models/create_chat_completion_request_function_call.rb +106 -0
- data/lib/openapi_openai/models/create_chat_completion_request_function_call_one_of.rb +222 -0
- data/lib/openapi_openai/models/create_chat_completion_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_chat_completion_request_stop.rb +106 -0
- data/lib/openapi_openai/models/create_chat_completion_response.rb +296 -0
- data/lib/openapi_openai/models/create_chat_completion_response_choices_inner.rb +266 -0
- data/lib/openapi_openai/models/create_chat_completion_stream_response.rb +287 -0
- data/lib/openapi_openai/models/create_chat_completion_stream_response_choices_inner.rb +266 -0
- data/lib/openapi_openai/models/create_completion_request.rb +586 -0
- data/lib/openapi_openai/models/create_completion_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_completion_request_prompt.rb +108 -0
- data/lib/openapi_openai/models/create_completion_request_stop.rb +106 -0
- data/lib/openapi_openai/models/create_completion_response.rb +296 -0
- data/lib/openapi_openai/models/create_completion_response_choices_inner.rb +299 -0
- data/lib/openapi_openai/models/create_completion_response_choices_inner_logprobs.rb +249 -0
- data/lib/openapi_openai/models/create_completion_response_usage.rb +253 -0
- data/lib/openapi_openai/models/create_edit_request.rb +362 -0
- data/lib/openapi_openai/models/create_edit_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_edit_response.rb +271 -0
- data/lib/openapi_openai/models/create_edit_response_choices_inner.rb +276 -0
- data/lib/openapi_openai/models/create_embedding_request.rb +247 -0
- data/lib/openapi_openai/models/create_embedding_request_input.rb +108 -0
- data/lib/openapi_openai/models/create_embedding_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_embedding_response.rb +271 -0
- data/lib/openapi_openai/models/create_embedding_response_data_inner.rb +255 -0
- data/lib/openapi_openai/models/create_embedding_response_usage.rb +237 -0
- data/lib/openapi_openai/models/create_fine_tune_request.rb +374 -0
- data/lib/openapi_openai/models/create_fine_tune_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_image_request.rb +341 -0
- data/lib/openapi_openai/models/create_moderation_request.rb +230 -0
- data/lib/openapi_openai/models/create_moderation_request_input.rb +106 -0
- data/lib/openapi_openai/models/create_moderation_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_moderation_response.rb +255 -0
- data/lib/openapi_openai/models/create_moderation_response_results_inner.rb +253 -0
- data/lib/openapi_openai/models/create_moderation_response_results_inner_categories.rb +317 -0
- data/lib/openapi_openai/models/create_moderation_response_results_inner_category_scores.rb +317 -0
- data/lib/openapi_openai/models/create_transcription_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_transcription_response.rb +221 -0
- data/lib/openapi_openai/models/create_translation_response.rb +221 -0
- data/lib/openapi_openai/models/delete_file_response.rb +253 -0
- data/lib/openapi_openai/models/delete_model_response.rb +253 -0
- data/lib/openapi_openai/models/error.rb +261 -0
- data/lib/openapi_openai/models/error_response.rb +221 -0
- data/lib/openapi_openai/models/fine_tune.rb +410 -0
- data/lib/openapi_openai/models/fine_tune_event.rb +269 -0
- data/lib/openapi_openai/models/images_response.rb +239 -0
- data/lib/openapi_openai/models/images_response_data_inner.rb +223 -0
- data/lib/openapi_openai/models/list_files_response.rb +239 -0
- data/lib/openapi_openai/models/list_fine_tune_events_response.rb +239 -0
- data/lib/openapi_openai/models/list_fine_tunes_response.rb +239 -0
- data/lib/openapi_openai/models/list_models_response.rb +239 -0
- data/lib/openapi_openai/models/model.rb +269 -0
- data/lib/openapi_openai/models/open_ai_file.rb +320 -0
- data/lib/openapi_openai/version.rb +15 -0
- data/lib/openapi_openai.rb +99 -0
- data/openapi_openai.gemspec +39 -0
- data/spec/api/open_ai_api_spec.rb +306 -0
- data/spec/models/chat_completion_functions_spec.rb +48 -0
- data/spec/models/chat_completion_request_message_function_call_spec.rb +42 -0
- data/spec/models/chat_completion_request_message_spec.rb +58 -0
- data/spec/models/chat_completion_response_message_spec.rb +52 -0
- data/spec/models/chat_completion_stream_response_delta_spec.rb +52 -0
- data/spec/models/create_chat_completion_request_function_call_one_of_spec.rb +36 -0
- data/spec/models/create_chat_completion_request_function_call_spec.rb +32 -0
- data/spec/models/create_chat_completion_request_model_spec.rb +32 -0
- data/spec/models/create_chat_completion_request_spec.rb +114 -0
- data/spec/models/create_chat_completion_request_stop_spec.rb +32 -0
- data/spec/models/create_chat_completion_response_choices_inner_spec.rb +52 -0
- data/spec/models/create_chat_completion_response_spec.rb +66 -0
- data/spec/models/create_chat_completion_stream_response_choices_inner_spec.rb +52 -0
- data/spec/models/create_chat_completion_stream_response_spec.rb +60 -0
- data/spec/models/create_completion_request_model_spec.rb +32 -0
- data/spec/models/create_completion_request_prompt_spec.rb +32 -0
- data/spec/models/create_completion_request_spec.rb +126 -0
- data/spec/models/create_completion_request_stop_spec.rb +32 -0
- data/spec/models/create_completion_response_choices_inner_logprobs_spec.rb +54 -0
- data/spec/models/create_completion_response_choices_inner_spec.rb +58 -0
- data/spec/models/create_completion_response_spec.rb +66 -0
- data/spec/models/create_completion_response_usage_spec.rb +48 -0
- data/spec/models/create_edit_request_model_spec.rb +32 -0
- data/spec/models/create_edit_request_spec.rb +66 -0
- data/spec/models/create_edit_response_choices_inner_spec.rb +58 -0
- data/spec/models/create_edit_response_spec.rb +54 -0
- data/spec/models/create_embedding_request_input_spec.rb +32 -0
- data/spec/models/create_embedding_request_model_spec.rb +32 -0
- data/spec/models/create_embedding_request_spec.rb +48 -0
- data/spec/models/create_embedding_response_data_inner_spec.rb +48 -0
- data/spec/models/create_embedding_response_spec.rb +54 -0
- data/spec/models/create_embedding_response_usage_spec.rb +42 -0
- data/spec/models/create_fine_tune_request_model_spec.rb +32 -0
- data/spec/models/create_fine_tune_request_spec.rb +102 -0
- data/spec/models/create_image_request_spec.rb +68 -0
- data/spec/models/create_moderation_request_input_spec.rb +32 -0
- data/spec/models/create_moderation_request_model_spec.rb +32 -0
- data/spec/models/create_moderation_request_spec.rb +42 -0
- data/spec/models/create_moderation_response_results_inner_categories_spec.rb +72 -0
- data/spec/models/create_moderation_response_results_inner_category_scores_spec.rb +72 -0
- data/spec/models/create_moderation_response_results_inner_spec.rb +48 -0
- data/spec/models/create_moderation_response_spec.rb +48 -0
- data/spec/models/create_transcription_request_model_spec.rb +32 -0
- data/spec/models/create_transcription_response_spec.rb +36 -0
- data/spec/models/create_translation_response_spec.rb +36 -0
- data/spec/models/delete_file_response_spec.rb +48 -0
- data/spec/models/delete_model_response_spec.rb +48 -0
- data/spec/models/error_response_spec.rb +36 -0
- data/spec/models/error_spec.rb +54 -0
- data/spec/models/fine_tune_event_spec.rb +54 -0
- data/spec/models/fine_tune_spec.rb +108 -0
- data/spec/models/images_response_data_inner_spec.rb +42 -0
- data/spec/models/images_response_spec.rb +42 -0
- data/spec/models/list_files_response_spec.rb +42 -0
- data/spec/models/list_fine_tune_events_response_spec.rb +42 -0
- data/spec/models/list_fine_tunes_response_spec.rb +42 -0
- data/spec/models/list_models_response_spec.rb +42 -0
- data/spec/models/model_spec.rb +54 -0
- data/spec/models/open_ai_file_spec.rb +78 -0
- data/spec/spec_helper.rb +111 -0
- metadata +348 -0
@@ -0,0 +1,221 @@
|
|
1
|
+
=begin
|
2
|
+
#OpenAI API
|
3
|
+
|
4
|
+
#APIs for sampling from and fine-tuning language models
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
Contact: blah+oapicf@cliffano.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module OpenApiOpenAIClient
|
17
|
+
class ErrorResponse
|
18
|
+
attr_accessor :error
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'error' => :'error'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'error' => :'Error'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OpenApiOpenAIClient::ErrorResponse` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OpenApiOpenAIClient::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'error')
|
61
|
+
self.error = attributes[:'error']
|
62
|
+
else
|
63
|
+
self.error = nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
68
|
+
# @return Array for valid properties with the reasons
|
69
|
+
def list_invalid_properties
|
70
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
71
|
+
invalid_properties = Array.new
|
72
|
+
if @error.nil?
|
73
|
+
invalid_properties.push('invalid value for "error", error cannot be nil.')
|
74
|
+
end
|
75
|
+
|
76
|
+
invalid_properties
|
77
|
+
end
|
78
|
+
|
79
|
+
# Check to see if the all the properties in the model are valid
|
80
|
+
# @return true if the model is valid
|
81
|
+
def valid?
|
82
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
83
|
+
return false if @error.nil?
|
84
|
+
true
|
85
|
+
end
|
86
|
+
|
87
|
+
# Checks equality by comparing each attribute.
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def ==(o)
|
90
|
+
return true if self.equal?(o)
|
91
|
+
self.class == o.class &&
|
92
|
+
error == o.error
|
93
|
+
end
|
94
|
+
|
95
|
+
# @see the `==` method
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def eql?(o)
|
98
|
+
self == o
|
99
|
+
end
|
100
|
+
|
101
|
+
# Calculates hash code according to all attributes.
|
102
|
+
# @return [Integer] Hash code
|
103
|
+
def hash
|
104
|
+
[error].hash
|
105
|
+
end
|
106
|
+
|
107
|
+
# Builds the object from hash
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
# @return [Object] Returns the model itself
|
110
|
+
def self.build_from_hash(attributes)
|
111
|
+
return nil unless attributes.is_a?(Hash)
|
112
|
+
attributes = attributes.transform_keys(&:to_sym)
|
113
|
+
transformed_hash = {}
|
114
|
+
openapi_types.each_pair do |key, type|
|
115
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
116
|
+
transformed_hash["#{key}"] = nil
|
117
|
+
elsif type =~ /\AArray<(.*)>/i
|
118
|
+
# check to ensure the input is an array given that the attribute
|
119
|
+
# is documented as an array but the input is not
|
120
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
121
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
122
|
+
end
|
123
|
+
elsif !attributes[attribute_map[key]].nil?
|
124
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
125
|
+
end
|
126
|
+
end
|
127
|
+
new(transformed_hash)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Deserializes the data based on type
|
131
|
+
# @param string type Data type
|
132
|
+
# @param string value Value to be deserialized
|
133
|
+
# @return [Object] Deserialized data
|
134
|
+
def self._deserialize(type, value)
|
135
|
+
case type.to_sym
|
136
|
+
when :Time
|
137
|
+
Time.parse(value)
|
138
|
+
when :Date
|
139
|
+
Date.parse(value)
|
140
|
+
when :String
|
141
|
+
value.to_s
|
142
|
+
when :Integer
|
143
|
+
value.to_i
|
144
|
+
when :Float
|
145
|
+
value.to_f
|
146
|
+
when :Boolean
|
147
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
148
|
+
true
|
149
|
+
else
|
150
|
+
false
|
151
|
+
end
|
152
|
+
when :Object
|
153
|
+
# generic object (usually a Hash), return directly
|
154
|
+
value
|
155
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
156
|
+
inner_type = Regexp.last_match[:inner_type]
|
157
|
+
value.map { |v| _deserialize(inner_type, v) }
|
158
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
159
|
+
k_type = Regexp.last_match[:k_type]
|
160
|
+
v_type = Regexp.last_match[:v_type]
|
161
|
+
{}.tap do |hash|
|
162
|
+
value.each do |k, v|
|
163
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
else # model
|
167
|
+
# models (e.g. Pet) or oneOf
|
168
|
+
klass = OpenApiOpenAIClient.const_get(type)
|
169
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the string representation of the object
|
174
|
+
# @return [String] String presentation of the object
|
175
|
+
def to_s
|
176
|
+
to_hash.to_s
|
177
|
+
end
|
178
|
+
|
179
|
+
# to_body is an alias to to_hash (backward compatibility)
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
181
|
+
def to_body
|
182
|
+
to_hash
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the object in the form of hash
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
187
|
+
def to_hash
|
188
|
+
hash = {}
|
189
|
+
self.class.attribute_map.each_pair do |attr, param|
|
190
|
+
value = self.send(attr)
|
191
|
+
if value.nil?
|
192
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
193
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
194
|
+
end
|
195
|
+
|
196
|
+
hash[param] = _to_hash(value)
|
197
|
+
end
|
198
|
+
hash
|
199
|
+
end
|
200
|
+
|
201
|
+
# Outputs non-array value in the form of hash
|
202
|
+
# For object, use to_hash. Otherwise, just return the value
|
203
|
+
# @param [Object] value Any valid value
|
204
|
+
# @return [Hash] Returns the value in the form of hash
|
205
|
+
def _to_hash(value)
|
206
|
+
if value.is_a?(Array)
|
207
|
+
value.compact.map { |v| _to_hash(v) }
|
208
|
+
elsif value.is_a?(Hash)
|
209
|
+
{}.tap do |hash|
|
210
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
211
|
+
end
|
212
|
+
elsif value.respond_to? :to_hash
|
213
|
+
value.to_hash
|
214
|
+
else
|
215
|
+
value
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
@@ -0,0 +1,410 @@
|
|
1
|
+
=begin
|
2
|
+
#OpenAI API
|
3
|
+
|
4
|
+
#APIs for sampling from and fine-tuning language models
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
Contact: blah+oapicf@cliffano.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module OpenApiOpenAIClient
|
17
|
+
class FineTune
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
attr_accessor :object
|
21
|
+
|
22
|
+
attr_accessor :created_at
|
23
|
+
|
24
|
+
attr_accessor :updated_at
|
25
|
+
|
26
|
+
attr_accessor :model
|
27
|
+
|
28
|
+
attr_accessor :fine_tuned_model
|
29
|
+
|
30
|
+
attr_accessor :organization_id
|
31
|
+
|
32
|
+
attr_accessor :status
|
33
|
+
|
34
|
+
attr_accessor :hyperparams
|
35
|
+
|
36
|
+
attr_accessor :training_files
|
37
|
+
|
38
|
+
attr_accessor :validation_files
|
39
|
+
|
40
|
+
attr_accessor :result_files
|
41
|
+
|
42
|
+
attr_accessor :events
|
43
|
+
|
44
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
45
|
+
def self.attribute_map
|
46
|
+
{
|
47
|
+
:'id' => :'id',
|
48
|
+
:'object' => :'object',
|
49
|
+
:'created_at' => :'created_at',
|
50
|
+
:'updated_at' => :'updated_at',
|
51
|
+
:'model' => :'model',
|
52
|
+
:'fine_tuned_model' => :'fine_tuned_model',
|
53
|
+
:'organization_id' => :'organization_id',
|
54
|
+
:'status' => :'status',
|
55
|
+
:'hyperparams' => :'hyperparams',
|
56
|
+
:'training_files' => :'training_files',
|
57
|
+
:'validation_files' => :'validation_files',
|
58
|
+
:'result_files' => :'result_files',
|
59
|
+
:'events' => :'events'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# Returns all the JSON keys this model knows about
|
64
|
+
def self.acceptable_attributes
|
65
|
+
attribute_map.values
|
66
|
+
end
|
67
|
+
|
68
|
+
# Attribute type mapping.
|
69
|
+
def self.openapi_types
|
70
|
+
{
|
71
|
+
:'id' => :'String',
|
72
|
+
:'object' => :'String',
|
73
|
+
:'created_at' => :'Integer',
|
74
|
+
:'updated_at' => :'Integer',
|
75
|
+
:'model' => :'String',
|
76
|
+
:'fine_tuned_model' => :'String',
|
77
|
+
:'organization_id' => :'String',
|
78
|
+
:'status' => :'String',
|
79
|
+
:'hyperparams' => :'Object',
|
80
|
+
:'training_files' => :'Array<OpenAIFile>',
|
81
|
+
:'validation_files' => :'Array<OpenAIFile>',
|
82
|
+
:'result_files' => :'Array<OpenAIFile>',
|
83
|
+
:'events' => :'Array<FineTuneEvent>'
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
# List of attributes with nullable: true
|
88
|
+
def self.openapi_nullable
|
89
|
+
Set.new([
|
90
|
+
:'fine_tuned_model',
|
91
|
+
])
|
92
|
+
end
|
93
|
+
|
94
|
+
# Initializes the object
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
def initialize(attributes = {})
|
97
|
+
if (!attributes.is_a?(Hash))
|
98
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OpenApiOpenAIClient::FineTune` initialize method"
|
99
|
+
end
|
100
|
+
|
101
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
102
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
103
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
104
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OpenApiOpenAIClient::FineTune`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
105
|
+
end
|
106
|
+
h[k.to_sym] = v
|
107
|
+
}
|
108
|
+
|
109
|
+
if attributes.key?(:'id')
|
110
|
+
self.id = attributes[:'id']
|
111
|
+
else
|
112
|
+
self.id = nil
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'object')
|
116
|
+
self.object = attributes[:'object']
|
117
|
+
else
|
118
|
+
self.object = nil
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'created_at')
|
122
|
+
self.created_at = attributes[:'created_at']
|
123
|
+
else
|
124
|
+
self.created_at = nil
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.key?(:'updated_at')
|
128
|
+
self.updated_at = attributes[:'updated_at']
|
129
|
+
else
|
130
|
+
self.updated_at = nil
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.key?(:'model')
|
134
|
+
self.model = attributes[:'model']
|
135
|
+
else
|
136
|
+
self.model = nil
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'fine_tuned_model')
|
140
|
+
self.fine_tuned_model = attributes[:'fine_tuned_model']
|
141
|
+
else
|
142
|
+
self.fine_tuned_model = nil
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.key?(:'organization_id')
|
146
|
+
self.organization_id = attributes[:'organization_id']
|
147
|
+
else
|
148
|
+
self.organization_id = nil
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.key?(:'status')
|
152
|
+
self.status = attributes[:'status']
|
153
|
+
else
|
154
|
+
self.status = nil
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.key?(:'hyperparams')
|
158
|
+
self.hyperparams = attributes[:'hyperparams']
|
159
|
+
else
|
160
|
+
self.hyperparams = nil
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.key?(:'training_files')
|
164
|
+
if (value = attributes[:'training_files']).is_a?(Array)
|
165
|
+
self.training_files = value
|
166
|
+
end
|
167
|
+
else
|
168
|
+
self.training_files = nil
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.key?(:'validation_files')
|
172
|
+
if (value = attributes[:'validation_files']).is_a?(Array)
|
173
|
+
self.validation_files = value
|
174
|
+
end
|
175
|
+
else
|
176
|
+
self.validation_files = nil
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.key?(:'result_files')
|
180
|
+
if (value = attributes[:'result_files']).is_a?(Array)
|
181
|
+
self.result_files = value
|
182
|
+
end
|
183
|
+
else
|
184
|
+
self.result_files = nil
|
185
|
+
end
|
186
|
+
|
187
|
+
if attributes.key?(:'events')
|
188
|
+
if (value = attributes[:'events']).is_a?(Array)
|
189
|
+
self.events = value
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
195
|
+
# @return Array for valid properties with the reasons
|
196
|
+
def list_invalid_properties
|
197
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
198
|
+
invalid_properties = Array.new
|
199
|
+
if @id.nil?
|
200
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
201
|
+
end
|
202
|
+
|
203
|
+
if @object.nil?
|
204
|
+
invalid_properties.push('invalid value for "object", object cannot be nil.')
|
205
|
+
end
|
206
|
+
|
207
|
+
if @created_at.nil?
|
208
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
209
|
+
end
|
210
|
+
|
211
|
+
if @updated_at.nil?
|
212
|
+
invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
|
213
|
+
end
|
214
|
+
|
215
|
+
if @model.nil?
|
216
|
+
invalid_properties.push('invalid value for "model", model cannot be nil.')
|
217
|
+
end
|
218
|
+
|
219
|
+
if @organization_id.nil?
|
220
|
+
invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.')
|
221
|
+
end
|
222
|
+
|
223
|
+
if @status.nil?
|
224
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
225
|
+
end
|
226
|
+
|
227
|
+
if @hyperparams.nil?
|
228
|
+
invalid_properties.push('invalid value for "hyperparams", hyperparams cannot be nil.')
|
229
|
+
end
|
230
|
+
|
231
|
+
if @training_files.nil?
|
232
|
+
invalid_properties.push('invalid value for "training_files", training_files cannot be nil.')
|
233
|
+
end
|
234
|
+
|
235
|
+
if @validation_files.nil?
|
236
|
+
invalid_properties.push('invalid value for "validation_files", validation_files cannot be nil.')
|
237
|
+
end
|
238
|
+
|
239
|
+
if @result_files.nil?
|
240
|
+
invalid_properties.push('invalid value for "result_files", result_files cannot be nil.')
|
241
|
+
end
|
242
|
+
|
243
|
+
invalid_properties
|
244
|
+
end
|
245
|
+
|
246
|
+
# Check to see if the all the properties in the model are valid
|
247
|
+
# @return true if the model is valid
|
248
|
+
def valid?
|
249
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
250
|
+
return false if @id.nil?
|
251
|
+
return false if @object.nil?
|
252
|
+
return false if @created_at.nil?
|
253
|
+
return false if @updated_at.nil?
|
254
|
+
return false if @model.nil?
|
255
|
+
return false if @organization_id.nil?
|
256
|
+
return false if @status.nil?
|
257
|
+
return false if @hyperparams.nil?
|
258
|
+
return false if @training_files.nil?
|
259
|
+
return false if @validation_files.nil?
|
260
|
+
return false if @result_files.nil?
|
261
|
+
true
|
262
|
+
end
|
263
|
+
|
264
|
+
# Checks equality by comparing each attribute.
|
265
|
+
# @param [Object] Object to be compared
|
266
|
+
def ==(o)
|
267
|
+
return true if self.equal?(o)
|
268
|
+
self.class == o.class &&
|
269
|
+
id == o.id &&
|
270
|
+
object == o.object &&
|
271
|
+
created_at == o.created_at &&
|
272
|
+
updated_at == o.updated_at &&
|
273
|
+
model == o.model &&
|
274
|
+
fine_tuned_model == o.fine_tuned_model &&
|
275
|
+
organization_id == o.organization_id &&
|
276
|
+
status == o.status &&
|
277
|
+
hyperparams == o.hyperparams &&
|
278
|
+
training_files == o.training_files &&
|
279
|
+
validation_files == o.validation_files &&
|
280
|
+
result_files == o.result_files &&
|
281
|
+
events == o.events
|
282
|
+
end
|
283
|
+
|
284
|
+
# @see the `==` method
|
285
|
+
# @param [Object] Object to be compared
|
286
|
+
def eql?(o)
|
287
|
+
self == o
|
288
|
+
end
|
289
|
+
|
290
|
+
# Calculates hash code according to all attributes.
|
291
|
+
# @return [Integer] Hash code
|
292
|
+
def hash
|
293
|
+
[id, object, created_at, updated_at, model, fine_tuned_model, organization_id, status, hyperparams, training_files, validation_files, result_files, events].hash
|
294
|
+
end
|
295
|
+
|
296
|
+
# Builds the object from hash
|
297
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
298
|
+
# @return [Object] Returns the model itself
|
299
|
+
def self.build_from_hash(attributes)
|
300
|
+
return nil unless attributes.is_a?(Hash)
|
301
|
+
attributes = attributes.transform_keys(&:to_sym)
|
302
|
+
transformed_hash = {}
|
303
|
+
openapi_types.each_pair do |key, type|
|
304
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
305
|
+
transformed_hash["#{key}"] = nil
|
306
|
+
elsif type =~ /\AArray<(.*)>/i
|
307
|
+
# check to ensure the input is an array given that the attribute
|
308
|
+
# is documented as an array but the input is not
|
309
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
310
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
311
|
+
end
|
312
|
+
elsif !attributes[attribute_map[key]].nil?
|
313
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
314
|
+
end
|
315
|
+
end
|
316
|
+
new(transformed_hash)
|
317
|
+
end
|
318
|
+
|
319
|
+
# Deserializes the data based on type
|
320
|
+
# @param string type Data type
|
321
|
+
# @param string value Value to be deserialized
|
322
|
+
# @return [Object] Deserialized data
|
323
|
+
def self._deserialize(type, value)
|
324
|
+
case type.to_sym
|
325
|
+
when :Time
|
326
|
+
Time.parse(value)
|
327
|
+
when :Date
|
328
|
+
Date.parse(value)
|
329
|
+
when :String
|
330
|
+
value.to_s
|
331
|
+
when :Integer
|
332
|
+
value.to_i
|
333
|
+
when :Float
|
334
|
+
value.to_f
|
335
|
+
when :Boolean
|
336
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
337
|
+
true
|
338
|
+
else
|
339
|
+
false
|
340
|
+
end
|
341
|
+
when :Object
|
342
|
+
# generic object (usually a Hash), return directly
|
343
|
+
value
|
344
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
345
|
+
inner_type = Regexp.last_match[:inner_type]
|
346
|
+
value.map { |v| _deserialize(inner_type, v) }
|
347
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
348
|
+
k_type = Regexp.last_match[:k_type]
|
349
|
+
v_type = Regexp.last_match[:v_type]
|
350
|
+
{}.tap do |hash|
|
351
|
+
value.each do |k, v|
|
352
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
353
|
+
end
|
354
|
+
end
|
355
|
+
else # model
|
356
|
+
# models (e.g. Pet) or oneOf
|
357
|
+
klass = OpenApiOpenAIClient.const_get(type)
|
358
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
# Returns the string representation of the object
|
363
|
+
# @return [String] String presentation of the object
|
364
|
+
def to_s
|
365
|
+
to_hash.to_s
|
366
|
+
end
|
367
|
+
|
368
|
+
# to_body is an alias to to_hash (backward compatibility)
|
369
|
+
# @return [Hash] Returns the object in the form of hash
|
370
|
+
def to_body
|
371
|
+
to_hash
|
372
|
+
end
|
373
|
+
|
374
|
+
# Returns the object in the form of hash
|
375
|
+
# @return [Hash] Returns the object in the form of hash
|
376
|
+
def to_hash
|
377
|
+
hash = {}
|
378
|
+
self.class.attribute_map.each_pair do |attr, param|
|
379
|
+
value = self.send(attr)
|
380
|
+
if value.nil?
|
381
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
382
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
383
|
+
end
|
384
|
+
|
385
|
+
hash[param] = _to_hash(value)
|
386
|
+
end
|
387
|
+
hash
|
388
|
+
end
|
389
|
+
|
390
|
+
# Outputs non-array value in the form of hash
|
391
|
+
# For object, use to_hash. Otherwise, just return the value
|
392
|
+
# @param [Object] value Any valid value
|
393
|
+
# @return [Hash] Returns the value in the form of hash
|
394
|
+
def _to_hash(value)
|
395
|
+
if value.is_a?(Array)
|
396
|
+
value.compact.map { |v| _to_hash(v) }
|
397
|
+
elsif value.is_a?(Hash)
|
398
|
+
{}.tap do |hash|
|
399
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
400
|
+
end
|
401
|
+
elsif value.respond_to? :to_hash
|
402
|
+
value.to_hash
|
403
|
+
else
|
404
|
+
value
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
end
|
409
|
+
|
410
|
+
end
|