azure_openai_client 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +10 -0
- data/Gemfile.lock +76 -0
- data/README.md +50 -87
- data/Rakefile +10 -0
- data/azure_openai_client.gemspec +38 -0
- data/docs/ChatCompletionsCreate200Response.md +28 -0
- data/docs/ChatCompletionsCreate200ResponseChoicesInner.md +22 -0
- data/docs/ChatCompletionsCreate200ResponseChoicesInnerMessage.md +20 -0
- data/docs/ChatCompletionsCreate200ResponseUsage.md +22 -0
- data/docs/ChatCompletionsCreateRequest.md +38 -0
- data/docs/ChatCompletionsCreateRequestMessagesInner.md +22 -0
- data/docs/ChatCompletionsCreateRequestStop.md +49 -0
- data/docs/CompletionsCreate200Response.md +28 -0
- data/docs/CompletionsCreate200ResponseChoicesInner.md +24 -0
- data/docs/CompletionsCreate200ResponseChoicesInnerLogprobs.md +24 -0
- data/docs/CompletionsCreate200ResponseUsage.md +22 -0
- data/docs/CompletionsCreateRequest.md +52 -0
- data/docs/CompletionsCreateRequestPrompt.md +49 -0
- data/docs/CompletionsCreateRequestStop.md +49 -0
- data/docs/DefaultApi.md +238 -0
- data/docs/EmbeddingsCreate200Response.md +24 -0
- data/docs/EmbeddingsCreate200ResponseDataInner.md +22 -0
- data/docs/EmbeddingsCreate200ResponseUsage.md +20 -0
- data/docs/EmbeddingsCreateRequest.md +24 -0
- data/docs/EmbeddingsCreateRequestInput.md +49 -0
- data/docs/ErrorResponse.md +18 -0
- data/docs/ErrorResponseError.md +24 -0
- data/git_push.sh +53 -0
- data/inference.json +816 -0
- data/lib/azure_openai_client/api/default_api.rb +120 -93
- data/lib/azure_openai_client/api_client.rb +77 -75
- data/lib/azure_openai_client/api_error.rb +5 -5
- data/lib/azure_openai_client/configuration.rb +114 -22
- data/lib/azure_openai_client/models/{inline_response_200_2.rb → chat_completions_create200_response.rb} +34 -26
- data/lib/azure_openai_client/models/{inline_response_200_2_choices.rb → chat_completions_create200_response_choices_inner.rb} +28 -20
- data/lib/azure_openai_client/models/{inline_response_200_2_message.rb → chat_completions_create200_response_choices_inner_message.rb} +28 -20
- data/lib/azure_openai_client/models/{inline_response_200_2_usage.rb → chat_completions_create200_response_usage.rb} +28 -20
- data/lib/azure_openai_client/models/{chat_completions_body.rb → chat_completions_create_request.rb} +183 -37
- data/lib/azure_openai_client/models/{deploymentsdeploymentidchatcompletions_messages.rb → chat_completions_create_request_messages_inner.rb} +30 -22
- data/lib/azure_openai_client/models/chat_completions_create_request_stop.rb +105 -0
- data/lib/azure_openai_client/models/{inline_response_200.rb → completions_create200_response.rb} +34 -26
- data/lib/azure_openai_client/models/{inline_response_200_choices.rb → completions_create200_response_choices_inner.rb} +30 -22
- data/lib/azure_openai_client/models/{inline_response_200_logprobs.rb → completions_create200_response_choices_inner_logprobs.rb} +30 -22
- data/lib/azure_openai_client/models/{inline_response_200_usage.rb → completions_create200_response_usage.rb} +28 -20
- data/lib/azure_openai_client/models/{deploymentid_completions_body.rb → completions_create_request.rb} +58 -52
- data/lib/azure_openai_client/models/completions_create_request_prompt.rb +105 -0
- data/lib/azure_openai_client/models/completions_create_request_stop.rb +105 -0
- data/lib/azure_openai_client/models/{inline_response_200_1.rb → embeddings_create200_response.rb} +30 -22
- data/lib/azure_openai_client/models/{inline_response_200_1_data.rb → embeddings_create200_response_data_inner.rb} +28 -20
- data/lib/azure_openai_client/models/{inline_response_200_1_usage.rb → embeddings_create200_response_usage.rb} +26 -18
- data/lib/azure_openai_client/models/embeddings_create_request.rb +252 -0
- data/lib/azure_openai_client/models/embeddings_create_request_input.rb +105 -0
- data/lib/azure_openai_client/models/error_response.rb +21 -13
- data/lib/azure_openai_client/models/error_response_error.rb +27 -19
- data/lib/azure_openai_client/version.rb +5 -6
- data/lib/azure_openai_client.rb +23 -23
- data/openapi-codegen.sh +12 -0
- data/openapi_config.yaml +15 -0
- data/spec/api/default_api_spec.rb +21 -22
- data/spec/api_client_spec.rb +15 -16
- data/spec/configuration_spec.rb +3 -3
- data/spec/models/chat_completions_create200_response_choices_inner_message_spec.rb +44 -0
- data/spec/models/chat_completions_create200_response_choices_inner_spec.rb +46 -0
- data/spec/models/chat_completions_create200_response_spec.rb +64 -0
- data/spec/models/chat_completions_create200_response_usage_spec.rb +46 -0
- data/spec/models/chat_completions_create_request_messages_inner_spec.rb +50 -0
- data/spec/models/chat_completions_create_request_spec.rb +94 -0
- data/spec/models/chat_completions_create_request_stop_spec.rb +31 -0
- data/spec/models/completions_create200_response_choices_inner_logprobs_spec.rb +52 -0
- data/spec/models/completions_create200_response_choices_inner_spec.rb +52 -0
- data/spec/models/completions_create200_response_spec.rb +64 -0
- data/spec/models/completions_create200_response_usage_spec.rb +46 -0
- data/spec/models/completions_create_request_prompt_spec.rb +31 -0
- data/spec/models/completions_create_request_spec.rb +136 -0
- data/spec/models/completions_create_request_stop_spec.rb +31 -0
- data/spec/models/embeddings_create200_response_data_inner_spec.rb +46 -0
- data/spec/models/embeddings_create200_response_spec.rb +52 -0
- data/spec/models/embeddings_create200_response_usage_spec.rb +40 -0
- data/spec/models/embeddings_create_request_input_spec.rb +31 -0
- data/spec/models/embeddings_create_request_spec.rb +52 -0
- data/spec/models/error_response_error_spec.rb +12 -20
- data/spec/models/error_response_spec.rb +9 -17
- data/spec/spec_helper.rb +4 -5
- metadata +91 -77
- data/lib/azure_openai_client/models/deploymentid_embeddings_body.rb +0 -202
- data/lib/azure_openai_client/models/one_ofchat_completions_body_stop.rb +0 -198
- data/lib/azure_openai_client/models/one_ofdeploymentid_completions_body_prompt.rb +0 -198
- data/lib/azure_openai_client/models/one_ofdeploymentid_completions_body_stop.rb +0 -198
- data/spec/models/chat_completions_body_spec.rb +0 -102
- data/spec/models/deploymentid_completions_body_spec.rb +0 -144
- data/spec/models/deploymentid_embeddings_body_spec.rb +0 -36
- data/spec/models/deploymentsdeploymentidchatcompletions_messages_spec.rb +0 -58
- data/spec/models/inline_response_200_1_data_spec.rb +0 -54
- data/spec/models/inline_response_200_1_spec.rb +0 -60
- data/spec/models/inline_response_200_1_usage_spec.rb +0 -48
- data/spec/models/inline_response_200_2_choices_spec.rb +0 -54
- data/spec/models/inline_response_200_2_message_spec.rb +0 -52
- data/spec/models/inline_response_200_2_spec.rb +0 -72
- data/spec/models/inline_response_200_2_usage_spec.rb +0 -54
- data/spec/models/inline_response_200_choices_spec.rb +0 -60
- data/spec/models/inline_response_200_logprobs_spec.rb +0 -60
- data/spec/models/inline_response_200_spec.rb +0 -72
- data/spec/models/inline_response_200_usage_spec.rb +0 -54
- data/spec/models/one_ofchat_completions_body_stop_spec.rb +0 -36
- data/spec/models/one_ofdeploymentid_completions_body_prompt_spec.rb +0 -36
- data/spec/models/one_ofdeploymentid_completions_body_stop_spec.rb +0 -36
data/lib/azure_openai_client/models/{inline_response_200.rb → completions_create200_response.rb}
RENAMED
@@ -1,20 +1,20 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
=begin
|
4
2
|
#Azure OpenAI Service API
|
5
3
|
|
6
4
|
#Azure OpenAI APIs for completions and search
|
7
5
|
|
8
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 2023-05-15
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
9
10
|
|
10
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
11
|
-
Swagger Codegen version: 3.0.42
|
12
11
|
=end
|
13
12
|
|
14
13
|
require 'date'
|
14
|
+
require 'time'
|
15
15
|
|
16
16
|
module AzureOpenaiClient
|
17
|
-
class
|
17
|
+
class CompletionsCreate200Response
|
18
18
|
attr_accessor :id
|
19
19
|
|
20
20
|
attr_accessor :object
|
@@ -30,24 +30,29 @@ module AzureOpenaiClient
|
|
30
30
|
# Attribute mapping from ruby-style variable name to JSON key.
|
31
31
|
def self.attribute_map
|
32
32
|
{
|
33
|
-
'id'
|
34
|
-
'object'
|
35
|
-
'created'
|
36
|
-
'model'
|
37
|
-
'choices'
|
38
|
-
'usage'
|
33
|
+
:'id' => :'id',
|
34
|
+
:'object' => :'object',
|
35
|
+
:'created' => :'created',
|
36
|
+
:'model' => :'model',
|
37
|
+
:'choices' => :'choices',
|
38
|
+
:'usage' => :'usage'
|
39
39
|
}
|
40
40
|
end
|
41
41
|
|
42
|
+
# Returns all the JSON keys this model knows about
|
43
|
+
def self.acceptable_attributes
|
44
|
+
attribute_map.values
|
45
|
+
end
|
46
|
+
|
42
47
|
# Attribute type mapping.
|
43
48
|
def self.openapi_types
|
44
49
|
{
|
45
|
-
'id'
|
46
|
-
'object'
|
47
|
-
'created'
|
48
|
-
'model'
|
49
|
-
'choices'
|
50
|
-
'usage'
|
50
|
+
:'id' => :'String',
|
51
|
+
:'object' => :'String',
|
52
|
+
:'created' => :'Integer',
|
53
|
+
:'model' => :'String',
|
54
|
+
:'choices' => :'Array<CompletionsCreate200ResponseChoicesInner>',
|
55
|
+
:'usage' => :'CompletionsCreate200ResponseUsage'
|
51
56
|
}
|
52
57
|
end
|
53
58
|
|
@@ -61,13 +66,13 @@ module AzureOpenaiClient
|
|
61
66
|
# @param [Hash] attributes Model attributes in the form of hash
|
62
67
|
def initialize(attributes = {})
|
63
68
|
if (!attributes.is_a?(Hash))
|
64
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `AzureOpenaiClient::
|
69
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AzureOpenaiClient::CompletionsCreate200Response` initialize method"
|
65
70
|
end
|
66
71
|
|
67
72
|
# check to see if the attribute exists and convert string to symbol for hash key
|
68
73
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
69
74
|
if (!self.class.attribute_map.key?(k.to_sym))
|
70
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `AzureOpenaiClient::
|
75
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AzureOpenaiClient::CompletionsCreate200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
71
76
|
end
|
72
77
|
h[k.to_sym] = v
|
73
78
|
}
|
@@ -174,8 +179,11 @@ module AzureOpenaiClient
|
|
174
179
|
# @return [Object] Returns the model itself
|
175
180
|
def build_from_hash(attributes)
|
176
181
|
return nil unless attributes.is_a?(Hash)
|
182
|
+
attributes = attributes.transform_keys(&:to_sym)
|
177
183
|
self.class.openapi_types.each_pair do |key, type|
|
178
|
-
if
|
184
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
185
|
+
self.send("#{key}=", nil)
|
186
|
+
elsif type =~ /\AArray<(.*)>/i
|
179
187
|
# check to ensure the input is an array given that the attribute
|
180
188
|
# is documented as an array but the input is not
|
181
189
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -183,8 +191,6 @@ module AzureOpenaiClient
|
|
183
191
|
end
|
184
192
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
185
193
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
186
|
-
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
187
|
-
self.send("#{key}=", nil)
|
188
194
|
end
|
189
195
|
end
|
190
196
|
|
@@ -197,8 +203,8 @@ module AzureOpenaiClient
|
|
197
203
|
# @return [Object] Deserialized data
|
198
204
|
def _deserialize(type, value)
|
199
205
|
case type.to_sym
|
200
|
-
when :
|
201
|
-
|
206
|
+
when :Time
|
207
|
+
Time.parse(value)
|
202
208
|
when :Date
|
203
209
|
Date.parse(value)
|
204
210
|
when :String
|
@@ -228,7 +234,9 @@ module AzureOpenaiClient
|
|
228
234
|
end
|
229
235
|
end
|
230
236
|
else # model
|
231
|
-
|
237
|
+
# models (e.g. Pet) or oneOf
|
238
|
+
klass = AzureOpenaiClient.const_get(type)
|
239
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
232
240
|
end
|
233
241
|
end
|
234
242
|
|
@@ -1,20 +1,20 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
=begin
|
4
2
|
#Azure OpenAI Service API
|
5
3
|
|
6
4
|
#Azure OpenAI APIs for completions and search
|
7
5
|
|
8
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 2023-05-15
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
9
10
|
|
10
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
11
|
-
Swagger Codegen version: 3.0.42
|
12
11
|
=end
|
13
12
|
|
14
13
|
require 'date'
|
14
|
+
require 'time'
|
15
15
|
|
16
16
|
module AzureOpenaiClient
|
17
|
-
class
|
17
|
+
class CompletionsCreate200ResponseChoicesInner
|
18
18
|
attr_accessor :text
|
19
19
|
|
20
20
|
attr_accessor :index
|
@@ -26,20 +26,25 @@ module AzureOpenaiClient
|
|
26
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
27
27
|
def self.attribute_map
|
28
28
|
{
|
29
|
-
'text'
|
30
|
-
'index'
|
31
|
-
'logprobs'
|
32
|
-
'finish_reason'
|
29
|
+
:'text' => :'text',
|
30
|
+
:'index' => :'index',
|
31
|
+
:'logprobs' => :'logprobs',
|
32
|
+
:'finish_reason' => :'finish_reason'
|
33
33
|
}
|
34
34
|
end
|
35
35
|
|
36
|
+
# Returns all the JSON keys this model knows about
|
37
|
+
def self.acceptable_attributes
|
38
|
+
attribute_map.values
|
39
|
+
end
|
40
|
+
|
36
41
|
# Attribute type mapping.
|
37
42
|
def self.openapi_types
|
38
43
|
{
|
39
|
-
'text'
|
40
|
-
'index'
|
41
|
-
'logprobs'
|
42
|
-
'finish_reason'
|
44
|
+
:'text' => :'String',
|
45
|
+
:'index' => :'Integer',
|
46
|
+
:'logprobs' => :'CompletionsCreate200ResponseChoicesInnerLogprobs',
|
47
|
+
:'finish_reason' => :'String'
|
43
48
|
}
|
44
49
|
end
|
45
50
|
|
@@ -53,13 +58,13 @@ module AzureOpenaiClient
|
|
53
58
|
# @param [Hash] attributes Model attributes in the form of hash
|
54
59
|
def initialize(attributes = {})
|
55
60
|
if (!attributes.is_a?(Hash))
|
56
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `AzureOpenaiClient::
|
61
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AzureOpenaiClient::CompletionsCreate200ResponseChoicesInner` initialize method"
|
57
62
|
end
|
58
63
|
|
59
64
|
# check to see if the attribute exists and convert string to symbol for hash key
|
60
65
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
61
66
|
if (!self.class.attribute_map.key?(k.to_sym))
|
62
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `AzureOpenaiClient::
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AzureOpenaiClient::CompletionsCreate200ResponseChoicesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
63
68
|
end
|
64
69
|
h[k.to_sym] = v
|
65
70
|
}
|
@@ -129,8 +134,11 @@ module AzureOpenaiClient
|
|
129
134
|
# @return [Object] Returns the model itself
|
130
135
|
def build_from_hash(attributes)
|
131
136
|
return nil unless attributes.is_a?(Hash)
|
137
|
+
attributes = attributes.transform_keys(&:to_sym)
|
132
138
|
self.class.openapi_types.each_pair do |key, type|
|
133
|
-
if
|
139
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
140
|
+
self.send("#{key}=", nil)
|
141
|
+
elsif type =~ /\AArray<(.*)>/i
|
134
142
|
# check to ensure the input is an array given that the attribute
|
135
143
|
# is documented as an array but the input is not
|
136
144
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -138,8 +146,6 @@ module AzureOpenaiClient
|
|
138
146
|
end
|
139
147
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
140
148
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
141
|
-
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
142
|
-
self.send("#{key}=", nil)
|
143
149
|
end
|
144
150
|
end
|
145
151
|
|
@@ -152,8 +158,8 @@ module AzureOpenaiClient
|
|
152
158
|
# @return [Object] Deserialized data
|
153
159
|
def _deserialize(type, value)
|
154
160
|
case type.to_sym
|
155
|
-
when :
|
156
|
-
|
161
|
+
when :Time
|
162
|
+
Time.parse(value)
|
157
163
|
when :Date
|
158
164
|
Date.parse(value)
|
159
165
|
when :String
|
@@ -183,7 +189,9 @@ module AzureOpenaiClient
|
|
183
189
|
end
|
184
190
|
end
|
185
191
|
else # model
|
186
|
-
|
192
|
+
# models (e.g. Pet) or oneOf
|
193
|
+
klass = AzureOpenaiClient.const_get(type)
|
194
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
187
195
|
end
|
188
196
|
end
|
189
197
|
|
@@ -1,20 +1,20 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
=begin
|
4
2
|
#Azure OpenAI Service API
|
5
3
|
|
6
4
|
#Azure OpenAI APIs for completions and search
|
7
5
|
|
8
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 2023-05-15
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
9
10
|
|
10
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
11
|
-
Swagger Codegen version: 3.0.42
|
12
11
|
=end
|
13
12
|
|
14
13
|
require 'date'
|
14
|
+
require 'time'
|
15
15
|
|
16
16
|
module AzureOpenaiClient
|
17
|
-
class
|
17
|
+
class CompletionsCreate200ResponseChoicesInnerLogprobs
|
18
18
|
attr_accessor :tokens
|
19
19
|
|
20
20
|
attr_accessor :token_logprobs
|
@@ -26,20 +26,25 @@ module AzureOpenaiClient
|
|
26
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
27
27
|
def self.attribute_map
|
28
28
|
{
|
29
|
-
'tokens'
|
30
|
-
'token_logprobs'
|
31
|
-
'top_logprobs'
|
32
|
-
'text_offset'
|
29
|
+
:'tokens' => :'tokens',
|
30
|
+
:'token_logprobs' => :'token_logprobs',
|
31
|
+
:'top_logprobs' => :'top_logprobs',
|
32
|
+
:'text_offset' => :'text_offset'
|
33
33
|
}
|
34
34
|
end
|
35
35
|
|
36
|
+
# Returns all the JSON keys this model knows about
|
37
|
+
def self.acceptable_attributes
|
38
|
+
attribute_map.values
|
39
|
+
end
|
40
|
+
|
36
41
|
# Attribute type mapping.
|
37
42
|
def self.openapi_types
|
38
43
|
{
|
39
|
-
'tokens'
|
40
|
-
'token_logprobs'
|
41
|
-
'top_logprobs'
|
42
|
-
'text_offset'
|
44
|
+
:'tokens' => :'Array<String>',
|
45
|
+
:'token_logprobs' => :'Array<Float>',
|
46
|
+
:'top_logprobs' => :'Array<Hash<String, Float>>',
|
47
|
+
:'text_offset' => :'Array<Integer>'
|
43
48
|
}
|
44
49
|
end
|
45
50
|
|
@@ -53,13 +58,13 @@ module AzureOpenaiClient
|
|
53
58
|
# @param [Hash] attributes Model attributes in the form of hash
|
54
59
|
def initialize(attributes = {})
|
55
60
|
if (!attributes.is_a?(Hash))
|
56
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `AzureOpenaiClient::
|
61
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AzureOpenaiClient::CompletionsCreate200ResponseChoicesInnerLogprobs` initialize method"
|
57
62
|
end
|
58
63
|
|
59
64
|
# check to see if the attribute exists and convert string to symbol for hash key
|
60
65
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
61
66
|
if (!self.class.attribute_map.key?(k.to_sym))
|
62
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `AzureOpenaiClient::
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AzureOpenaiClient::CompletionsCreate200ResponseChoicesInnerLogprobs`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
63
68
|
end
|
64
69
|
h[k.to_sym] = v
|
65
70
|
}
|
@@ -137,8 +142,11 @@ module AzureOpenaiClient
|
|
137
142
|
# @return [Object] Returns the model itself
|
138
143
|
def build_from_hash(attributes)
|
139
144
|
return nil unless attributes.is_a?(Hash)
|
145
|
+
attributes = attributes.transform_keys(&:to_sym)
|
140
146
|
self.class.openapi_types.each_pair do |key, type|
|
141
|
-
if
|
147
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
148
|
+
self.send("#{key}=", nil)
|
149
|
+
elsif type =~ /\AArray<(.*)>/i
|
142
150
|
# check to ensure the input is an array given that the attribute
|
143
151
|
# is documented as an array but the input is not
|
144
152
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -146,8 +154,6 @@ module AzureOpenaiClient
|
|
146
154
|
end
|
147
155
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
148
156
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
149
|
-
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
150
|
-
self.send("#{key}=", nil)
|
151
157
|
end
|
152
158
|
end
|
153
159
|
|
@@ -160,8 +166,8 @@ module AzureOpenaiClient
|
|
160
166
|
# @return [Object] Deserialized data
|
161
167
|
def _deserialize(type, value)
|
162
168
|
case type.to_sym
|
163
|
-
when :
|
164
|
-
|
169
|
+
when :Time
|
170
|
+
Time.parse(value)
|
165
171
|
when :Date
|
166
172
|
Date.parse(value)
|
167
173
|
when :String
|
@@ -191,7 +197,9 @@ module AzureOpenaiClient
|
|
191
197
|
end
|
192
198
|
end
|
193
199
|
else # model
|
194
|
-
|
200
|
+
# models (e.g. Pet) or oneOf
|
201
|
+
klass = AzureOpenaiClient.const_get(type)
|
202
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
195
203
|
end
|
196
204
|
end
|
197
205
|
|
@@ -1,20 +1,20 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
=begin
|
4
2
|
#Azure OpenAI Service API
|
5
3
|
|
6
4
|
#Azure OpenAI APIs for completions and search
|
7
5
|
|
8
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 2023-05-15
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
9
10
|
|
10
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
11
|
-
Swagger Codegen version: 3.0.42
|
12
11
|
=end
|
13
12
|
|
14
13
|
require 'date'
|
14
|
+
require 'time'
|
15
15
|
|
16
16
|
module AzureOpenaiClient
|
17
|
-
class
|
17
|
+
class CompletionsCreate200ResponseUsage
|
18
18
|
attr_accessor :completion_tokens
|
19
19
|
|
20
20
|
attr_accessor :prompt_tokens
|
@@ -24,18 +24,23 @@ module AzureOpenaiClient
|
|
24
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
25
25
|
def self.attribute_map
|
26
26
|
{
|
27
|
-
'completion_tokens'
|
28
|
-
'prompt_tokens'
|
29
|
-
'total_tokens'
|
27
|
+
:'completion_tokens' => :'completion_tokens',
|
28
|
+
:'prompt_tokens' => :'prompt_tokens',
|
29
|
+
:'total_tokens' => :'total_tokens'
|
30
30
|
}
|
31
31
|
end
|
32
32
|
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
33
38
|
# Attribute type mapping.
|
34
39
|
def self.openapi_types
|
35
40
|
{
|
36
|
-
'completion_tokens'
|
37
|
-
'prompt_tokens'
|
38
|
-
'total_tokens'
|
41
|
+
:'completion_tokens' => :'Float',
|
42
|
+
:'prompt_tokens' => :'Float',
|
43
|
+
:'total_tokens' => :'Float'
|
39
44
|
}
|
40
45
|
end
|
41
46
|
|
@@ -49,13 +54,13 @@ module AzureOpenaiClient
|
|
49
54
|
# @param [Hash] attributes Model attributes in the form of hash
|
50
55
|
def initialize(attributes = {})
|
51
56
|
if (!attributes.is_a?(Hash))
|
52
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `AzureOpenaiClient::
|
57
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AzureOpenaiClient::CompletionsCreate200ResponseUsage` initialize method"
|
53
58
|
end
|
54
59
|
|
55
60
|
# check to see if the attribute exists and convert string to symbol for hash key
|
56
61
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
57
62
|
if (!self.class.attribute_map.key?(k.to_sym))
|
58
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `AzureOpenaiClient::
|
63
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AzureOpenaiClient::CompletionsCreate200ResponseUsage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
59
64
|
end
|
60
65
|
h[k.to_sym] = v
|
61
66
|
}
|
@@ -135,8 +140,11 @@ module AzureOpenaiClient
|
|
135
140
|
# @return [Object] Returns the model itself
|
136
141
|
def build_from_hash(attributes)
|
137
142
|
return nil unless attributes.is_a?(Hash)
|
143
|
+
attributes = attributes.transform_keys(&:to_sym)
|
138
144
|
self.class.openapi_types.each_pair do |key, type|
|
139
|
-
if
|
145
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
146
|
+
self.send("#{key}=", nil)
|
147
|
+
elsif type =~ /\AArray<(.*)>/i
|
140
148
|
# check to ensure the input is an array given that the attribute
|
141
149
|
# is documented as an array but the input is not
|
142
150
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -144,8 +152,6 @@ module AzureOpenaiClient
|
|
144
152
|
end
|
145
153
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
146
154
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
147
|
-
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
148
|
-
self.send("#{key}=", nil)
|
149
155
|
end
|
150
156
|
end
|
151
157
|
|
@@ -158,8 +164,8 @@ module AzureOpenaiClient
|
|
158
164
|
# @return [Object] Deserialized data
|
159
165
|
def _deserialize(type, value)
|
160
166
|
case type.to_sym
|
161
|
-
when :
|
162
|
-
|
167
|
+
when :Time
|
168
|
+
Time.parse(value)
|
163
169
|
when :Date
|
164
170
|
Date.parse(value)
|
165
171
|
when :String
|
@@ -189,7 +195,9 @@ module AzureOpenaiClient
|
|
189
195
|
end
|
190
196
|
end
|
191
197
|
else # model
|
192
|
-
|
198
|
+
# models (e.g. Pet) or oneOf
|
199
|
+
klass = AzureOpenaiClient.const_get(type)
|
200
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
193
201
|
end
|
194
202
|
end
|
195
203
|
|
@@ -1,21 +1,20 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
=begin
|
4
2
|
#Azure OpenAI Service API
|
5
3
|
|
6
4
|
#Azure OpenAI APIs for completions and search
|
7
5
|
|
8
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 2023-05-15
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
9
10
|
|
10
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
11
|
-
Swagger Codegen version: 3.0.42
|
12
11
|
=end
|
13
12
|
|
14
13
|
require 'date'
|
14
|
+
require 'time'
|
15
15
|
|
16
16
|
module AzureOpenaiClient
|
17
|
-
class
|
18
|
-
# The prompt(s) to generate completions for, encoded as a string or array of strings. Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. Maximum allowed size of string list is 2048.
|
17
|
+
class CompletionsCreateRequest
|
19
18
|
attr_accessor :prompt
|
20
19
|
|
21
20
|
# The token count of your prompt plus max_tokens cannot exceed the model's context length. Most models have a context length of 2048 tokens (except for the newest models, which support 4096). Has minimum of 0.
|
@@ -51,7 +50,6 @@ module AzureOpenaiClient
|
|
51
50
|
# Echo back the prompt in addition to the completion
|
52
51
|
attr_accessor :echo
|
53
52
|
|
54
|
-
# Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
|
55
53
|
attr_accessor :stop
|
56
54
|
|
57
55
|
attr_accessor :completion_config
|
@@ -71,48 +69,53 @@ module AzureOpenaiClient
|
|
71
69
|
# Attribute mapping from ruby-style variable name to JSON key.
|
72
70
|
def self.attribute_map
|
73
71
|
{
|
74
|
-
'prompt'
|
75
|
-
'max_tokens'
|
76
|
-
'temperature'
|
77
|
-
'top_p'
|
78
|
-
'logit_bias'
|
79
|
-
'user'
|
80
|
-
'n'
|
81
|
-
'stream'
|
82
|
-
'logprobs'
|
83
|
-
'model'
|
84
|
-
'suffix'
|
85
|
-
'echo'
|
86
|
-
'stop'
|
87
|
-
'completion_config'
|
88
|
-
'cache_level'
|
89
|
-
'presence_penalty'
|
90
|
-
'frequency_penalty'
|
91
|
-
'best_of'
|
72
|
+
:'prompt' => :'prompt',
|
73
|
+
:'max_tokens' => :'max_tokens',
|
74
|
+
:'temperature' => :'temperature',
|
75
|
+
:'top_p' => :'top_p',
|
76
|
+
:'logit_bias' => :'logit_bias',
|
77
|
+
:'user' => :'user',
|
78
|
+
:'n' => :'n',
|
79
|
+
:'stream' => :'stream',
|
80
|
+
:'logprobs' => :'logprobs',
|
81
|
+
:'model' => :'model',
|
82
|
+
:'suffix' => :'suffix',
|
83
|
+
:'echo' => :'echo',
|
84
|
+
:'stop' => :'stop',
|
85
|
+
:'completion_config' => :'completion_config',
|
86
|
+
:'cache_level' => :'cache_level',
|
87
|
+
:'presence_penalty' => :'presence_penalty',
|
88
|
+
:'frequency_penalty' => :'frequency_penalty',
|
89
|
+
:'best_of' => :'best_of'
|
92
90
|
}
|
93
91
|
end
|
94
92
|
|
93
|
+
# Returns all the JSON keys this model knows about
|
94
|
+
def self.acceptable_attributes
|
95
|
+
attribute_map.values
|
96
|
+
end
|
97
|
+
|
95
98
|
# Attribute type mapping.
|
96
99
|
def self.openapi_types
|
97
100
|
{
|
98
|
-
'prompt'
|
99
|
-
'max_tokens'
|
100
|
-
'temperature'
|
101
|
-
'top_p'
|
102
|
-
'logit_bias'
|
103
|
-
'user'
|
104
|
-
'n'
|
105
|
-
'stream'
|
106
|
-
'logprobs'
|
107
|
-
'model'
|
108
|
-
'suffix'
|
109
|
-
'echo'
|
110
|
-
'stop'
|
111
|
-
'completion_config'
|
112
|
-
'cache_level'
|
113
|
-
'presence_penalty'
|
114
|
-
'frequency_penalty'
|
115
|
-
'best_of'
|
101
|
+
:'prompt' => :'CompletionsCreateRequestPrompt',
|
102
|
+
:'max_tokens' => :'Integer',
|
103
|
+
:'temperature' => :'Float',
|
104
|
+
:'top_p' => :'Float',
|
105
|
+
:'logit_bias' => :'Object',
|
106
|
+
:'user' => :'String',
|
107
|
+
:'n' => :'Integer',
|
108
|
+
:'stream' => :'Boolean',
|
109
|
+
:'logprobs' => :'Integer',
|
110
|
+
:'model' => :'String',
|
111
|
+
:'suffix' => :'String',
|
112
|
+
:'echo' => :'Boolean',
|
113
|
+
:'stop' => :'CompletionsCreateRequestStop',
|
114
|
+
:'completion_config' => :'String',
|
115
|
+
:'cache_level' => :'Integer',
|
116
|
+
:'presence_penalty' => :'Float',
|
117
|
+
:'frequency_penalty' => :'Float',
|
118
|
+
:'best_of' => :'Integer'
|
116
119
|
}
|
117
120
|
end
|
118
121
|
|
@@ -137,13 +140,13 @@ module AzureOpenaiClient
|
|
137
140
|
# @param [Hash] attributes Model attributes in the form of hash
|
138
141
|
def initialize(attributes = {})
|
139
142
|
if (!attributes.is_a?(Hash))
|
140
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `AzureOpenaiClient::
|
143
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AzureOpenaiClient::CompletionsCreateRequest` initialize method"
|
141
144
|
end
|
142
145
|
|
143
146
|
# check to see if the attribute exists and convert string to symbol for hash key
|
144
147
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
145
148
|
if (!self.class.attribute_map.key?(k.to_sym))
|
146
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `AzureOpenaiClient::
|
149
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AzureOpenaiClient::CompletionsCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
147
150
|
end
|
148
151
|
h[k.to_sym] = v
|
149
152
|
}
|
@@ -299,8 +302,11 @@ module AzureOpenaiClient
|
|
299
302
|
# @return [Object] Returns the model itself
|
300
303
|
def build_from_hash(attributes)
|
301
304
|
return nil unless attributes.is_a?(Hash)
|
305
|
+
attributes = attributes.transform_keys(&:to_sym)
|
302
306
|
self.class.openapi_types.each_pair do |key, type|
|
303
|
-
if
|
307
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
308
|
+
self.send("#{key}=", nil)
|
309
|
+
elsif type =~ /\AArray<(.*)>/i
|
304
310
|
# check to ensure the input is an array given that the attribute
|
305
311
|
# is documented as an array but the input is not
|
306
312
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -308,8 +314,6 @@ module AzureOpenaiClient
|
|
308
314
|
end
|
309
315
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
310
316
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
311
|
-
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
312
|
-
self.send("#{key}=", nil)
|
313
317
|
end
|
314
318
|
end
|
315
319
|
|
@@ -322,8 +326,8 @@ module AzureOpenaiClient
|
|
322
326
|
# @return [Object] Deserialized data
|
323
327
|
def _deserialize(type, value)
|
324
328
|
case type.to_sym
|
325
|
-
when :
|
326
|
-
|
329
|
+
when :Time
|
330
|
+
Time.parse(value)
|
327
331
|
when :Date
|
328
332
|
Date.parse(value)
|
329
333
|
when :String
|
@@ -353,7 +357,9 @@ module AzureOpenaiClient
|
|
353
357
|
end
|
354
358
|
end
|
355
359
|
else # model
|
356
|
-
|
360
|
+
# models (e.g. Pet) or oneOf
|
361
|
+
klass = AzureOpenaiClient.const_get(type)
|
362
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
357
363
|
end
|
358
364
|
end
|
359
365
|
|