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.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +10 -0
  3. data/Gemfile.lock +76 -0
  4. data/README.md +50 -87
  5. data/Rakefile +10 -0
  6. data/azure_openai_client.gemspec +38 -0
  7. data/docs/ChatCompletionsCreate200Response.md +28 -0
  8. data/docs/ChatCompletionsCreate200ResponseChoicesInner.md +22 -0
  9. data/docs/ChatCompletionsCreate200ResponseChoicesInnerMessage.md +20 -0
  10. data/docs/ChatCompletionsCreate200ResponseUsage.md +22 -0
  11. data/docs/ChatCompletionsCreateRequest.md +38 -0
  12. data/docs/ChatCompletionsCreateRequestMessagesInner.md +22 -0
  13. data/docs/ChatCompletionsCreateRequestStop.md +49 -0
  14. data/docs/CompletionsCreate200Response.md +28 -0
  15. data/docs/CompletionsCreate200ResponseChoicesInner.md +24 -0
  16. data/docs/CompletionsCreate200ResponseChoicesInnerLogprobs.md +24 -0
  17. data/docs/CompletionsCreate200ResponseUsage.md +22 -0
  18. data/docs/CompletionsCreateRequest.md +52 -0
  19. data/docs/CompletionsCreateRequestPrompt.md +49 -0
  20. data/docs/CompletionsCreateRequestStop.md +49 -0
  21. data/docs/DefaultApi.md +238 -0
  22. data/docs/EmbeddingsCreate200Response.md +24 -0
  23. data/docs/EmbeddingsCreate200ResponseDataInner.md +22 -0
  24. data/docs/EmbeddingsCreate200ResponseUsage.md +20 -0
  25. data/docs/EmbeddingsCreateRequest.md +24 -0
  26. data/docs/EmbeddingsCreateRequestInput.md +49 -0
  27. data/docs/ErrorResponse.md +18 -0
  28. data/docs/ErrorResponseError.md +24 -0
  29. data/git_push.sh +53 -0
  30. data/inference.json +816 -0
  31. data/lib/azure_openai_client/api/default_api.rb +120 -93
  32. data/lib/azure_openai_client/api_client.rb +77 -75
  33. data/lib/azure_openai_client/api_error.rb +5 -5
  34. data/lib/azure_openai_client/configuration.rb +114 -22
  35. data/lib/azure_openai_client/models/{inline_response_200_2.rb → chat_completions_create200_response.rb} +34 -26
  36. data/lib/azure_openai_client/models/{inline_response_200_2_choices.rb → chat_completions_create200_response_choices_inner.rb} +28 -20
  37. data/lib/azure_openai_client/models/{inline_response_200_2_message.rb → chat_completions_create200_response_choices_inner_message.rb} +28 -20
  38. data/lib/azure_openai_client/models/{inline_response_200_2_usage.rb → chat_completions_create200_response_usage.rb} +28 -20
  39. data/lib/azure_openai_client/models/{chat_completions_body.rb → chat_completions_create_request.rb} +183 -37
  40. data/lib/azure_openai_client/models/{deploymentsdeploymentidchatcompletions_messages.rb → chat_completions_create_request_messages_inner.rb} +30 -22
  41. data/lib/azure_openai_client/models/chat_completions_create_request_stop.rb +105 -0
  42. data/lib/azure_openai_client/models/{inline_response_200.rb → completions_create200_response.rb} +34 -26
  43. data/lib/azure_openai_client/models/{inline_response_200_choices.rb → completions_create200_response_choices_inner.rb} +30 -22
  44. data/lib/azure_openai_client/models/{inline_response_200_logprobs.rb → completions_create200_response_choices_inner_logprobs.rb} +30 -22
  45. data/lib/azure_openai_client/models/{inline_response_200_usage.rb → completions_create200_response_usage.rb} +28 -20
  46. data/lib/azure_openai_client/models/{deploymentid_completions_body.rb → completions_create_request.rb} +58 -52
  47. data/lib/azure_openai_client/models/completions_create_request_prompt.rb +105 -0
  48. data/lib/azure_openai_client/models/completions_create_request_stop.rb +105 -0
  49. data/lib/azure_openai_client/models/{inline_response_200_1.rb → embeddings_create200_response.rb} +30 -22
  50. data/lib/azure_openai_client/models/{inline_response_200_1_data.rb → embeddings_create200_response_data_inner.rb} +28 -20
  51. data/lib/azure_openai_client/models/{inline_response_200_1_usage.rb → embeddings_create200_response_usage.rb} +26 -18
  52. data/lib/azure_openai_client/models/embeddings_create_request.rb +252 -0
  53. data/lib/azure_openai_client/models/embeddings_create_request_input.rb +105 -0
  54. data/lib/azure_openai_client/models/error_response.rb +21 -13
  55. data/lib/azure_openai_client/models/error_response_error.rb +27 -19
  56. data/lib/azure_openai_client/version.rb +5 -6
  57. data/lib/azure_openai_client.rb +23 -23
  58. data/openapi-codegen.sh +12 -0
  59. data/openapi_config.yaml +15 -0
  60. data/spec/api/default_api_spec.rb +21 -22
  61. data/spec/api_client_spec.rb +15 -16
  62. data/spec/configuration_spec.rb +3 -3
  63. data/spec/models/chat_completions_create200_response_choices_inner_message_spec.rb +44 -0
  64. data/spec/models/chat_completions_create200_response_choices_inner_spec.rb +46 -0
  65. data/spec/models/chat_completions_create200_response_spec.rb +64 -0
  66. data/spec/models/chat_completions_create200_response_usage_spec.rb +46 -0
  67. data/spec/models/chat_completions_create_request_messages_inner_spec.rb +50 -0
  68. data/spec/models/chat_completions_create_request_spec.rb +94 -0
  69. data/spec/models/chat_completions_create_request_stop_spec.rb +31 -0
  70. data/spec/models/completions_create200_response_choices_inner_logprobs_spec.rb +52 -0
  71. data/spec/models/completions_create200_response_choices_inner_spec.rb +52 -0
  72. data/spec/models/completions_create200_response_spec.rb +64 -0
  73. data/spec/models/completions_create200_response_usage_spec.rb +46 -0
  74. data/spec/models/completions_create_request_prompt_spec.rb +31 -0
  75. data/spec/models/completions_create_request_spec.rb +136 -0
  76. data/spec/models/completions_create_request_stop_spec.rb +31 -0
  77. data/spec/models/embeddings_create200_response_data_inner_spec.rb +46 -0
  78. data/spec/models/embeddings_create200_response_spec.rb +52 -0
  79. data/spec/models/embeddings_create200_response_usage_spec.rb +40 -0
  80. data/spec/models/embeddings_create_request_input_spec.rb +31 -0
  81. data/spec/models/embeddings_create_request_spec.rb +52 -0
  82. data/spec/models/error_response_error_spec.rb +12 -20
  83. data/spec/models/error_response_spec.rb +9 -17
  84. data/spec/spec_helper.rb +4 -5
  85. metadata +91 -77
  86. data/lib/azure_openai_client/models/deploymentid_embeddings_body.rb +0 -202
  87. data/lib/azure_openai_client/models/one_ofchat_completions_body_stop.rb +0 -198
  88. data/lib/azure_openai_client/models/one_ofdeploymentid_completions_body_prompt.rb +0 -198
  89. data/lib/azure_openai_client/models/one_ofdeploymentid_completions_body_stop.rb +0 -198
  90. data/spec/models/chat_completions_body_spec.rb +0 -102
  91. data/spec/models/deploymentid_completions_body_spec.rb +0 -144
  92. data/spec/models/deploymentid_embeddings_body_spec.rb +0 -36
  93. data/spec/models/deploymentsdeploymentidchatcompletions_messages_spec.rb +0 -58
  94. data/spec/models/inline_response_200_1_data_spec.rb +0 -54
  95. data/spec/models/inline_response_200_1_spec.rb +0 -60
  96. data/spec/models/inline_response_200_1_usage_spec.rb +0 -48
  97. data/spec/models/inline_response_200_2_choices_spec.rb +0 -54
  98. data/spec/models/inline_response_200_2_message_spec.rb +0 -52
  99. data/spec/models/inline_response_200_2_spec.rb +0 -72
  100. data/spec/models/inline_response_200_2_usage_spec.rb +0 -54
  101. data/spec/models/inline_response_200_choices_spec.rb +0 -60
  102. data/spec/models/inline_response_200_logprobs_spec.rb +0 -60
  103. data/spec/models/inline_response_200_spec.rb +0 -72
  104. data/spec/models/inline_response_200_usage_spec.rb +0 -54
  105. data/spec/models/one_ofchat_completions_body_stop_spec.rb +0 -36
  106. data/spec/models/one_ofdeploymentid_completions_body_prompt_spec.rb +0 -36
  107. data/spec/models/one_ofdeploymentid_completions_body_stop_spec.rb +0 -36
@@ -0,0 +1,252 @@
1
+ =begin
2
+ #Azure OpenAI Service API
3
+
4
+ #Azure OpenAI APIs for completions and search
5
+
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
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module AzureOpenaiClient
17
+ class EmbeddingsCreateRequest
18
+ attr_accessor :input
19
+
20
+ # A unique identifier representing your end-user, which can help monitoring and detecting abuse.
21
+ attr_accessor :user
22
+
23
+ # input type of embedding search to use
24
+ attr_accessor :input_type
25
+
26
+ # ID of the model to use. You can use the Models_List operation to see all of your available models, or see our Models_Get overview for descriptions of them.
27
+ attr_accessor :model
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'input' => :'input',
33
+ :'user' => :'user',
34
+ :'input_type' => :'input_type',
35
+ :'model' => :'model'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'input' => :'EmbeddingsCreateRequestInput',
48
+ :'user' => :'String',
49
+ :'input_type' => :'String',
50
+ :'model' => :'String'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AzureOpenaiClient::EmbeddingsCreateRequest` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AzureOpenaiClient::EmbeddingsCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'input')
76
+ self.input = attributes[:'input']
77
+ end
78
+
79
+ if attributes.key?(:'user')
80
+ self.user = attributes[:'user']
81
+ end
82
+
83
+ if attributes.key?(:'input_type')
84
+ self.input_type = attributes[:'input_type']
85
+ end
86
+
87
+ if attributes.key?(:'model')
88
+ self.model = attributes[:'model']
89
+ end
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properties with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ if @input.nil?
97
+ invalid_properties.push('invalid value for "input", input cannot be nil.')
98
+ end
99
+
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ return false if @input.nil?
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ input == o.input &&
116
+ user == o.user &&
117
+ input_type == o.input_type &&
118
+ model == o.model
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Integer] Hash code
129
+ def hash
130
+ [input, user, input_type, model].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def self.build_from_hash(attributes)
137
+ new.build_from_hash(attributes)
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ attributes = attributes.transform_keys(&:to_sym)
146
+ self.class.openapi_types.each_pair do |key, type|
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
150
+ # check to ensure the input is an array given that the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
153
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
154
+ end
155
+ elsif !attributes[self.class.attribute_map[key]].nil?
156
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
157
+ end
158
+ end
159
+
160
+ self
161
+ end
162
+
163
+ # Deserializes the data based on type
164
+ # @param string type Data type
165
+ # @param string value Value to be deserialized
166
+ # @return [Object] Deserialized data
167
+ def _deserialize(type, value)
168
+ case type.to_sym
169
+ when :Time
170
+ Time.parse(value)
171
+ when :Date
172
+ Date.parse(value)
173
+ when :String
174
+ value.to_s
175
+ when :Integer
176
+ value.to_i
177
+ when :Float
178
+ value.to_f
179
+ when :Boolean
180
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
+ true
182
+ else
183
+ false
184
+ end
185
+ when :Object
186
+ # generic object (usually a Hash), return directly
187
+ value
188
+ when /\AArray<(?<inner_type>.+)>\z/
189
+ inner_type = Regexp.last_match[:inner_type]
190
+ value.map { |v| _deserialize(inner_type, v) }
191
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
+ k_type = Regexp.last_match[:k_type]
193
+ v_type = Regexp.last_match[:v_type]
194
+ {}.tap do |hash|
195
+ value.each do |k, v|
196
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
+ end
198
+ end
199
+ else # model
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)
203
+ end
204
+ end
205
+
206
+ # Returns the string representation of the object
207
+ # @return [String] String presentation of the object
208
+ def to_s
209
+ to_hash.to_s
210
+ end
211
+
212
+ # to_body is an alias to to_hash (backward compatibility)
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_body
215
+ to_hash
216
+ end
217
+
218
+ # Returns the object in the form of hash
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_hash
221
+ hash = {}
222
+ self.class.attribute_map.each_pair do |attr, param|
223
+ value = self.send(attr)
224
+ if value.nil?
225
+ is_nullable = self.class.openapi_nullable.include?(attr)
226
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
+ end
228
+
229
+ hash[param] = _to_hash(value)
230
+ end
231
+ hash
232
+ end
233
+
234
+ # Outputs non-array value in the form of hash
235
+ # For object, use to_hash. Otherwise, just return the value
236
+ # @param [Object] value Any valid value
237
+ # @return [Hash] Returns the value in the form of hash
238
+ def _to_hash(value)
239
+ if value.is_a?(Array)
240
+ value.compact.map { |v| _to_hash(v) }
241
+ elsif value.is_a?(Hash)
242
+ {}.tap do |hash|
243
+ value.each { |k, v| hash[k] = _to_hash(v) }
244
+ end
245
+ elsif value.respond_to? :to_hash
246
+ value.to_hash
247
+ else
248
+ value
249
+ end
250
+ end
251
+ end
252
+ end
@@ -0,0 +1,105 @@
1
+ =begin
2
+ #Azure OpenAI Service API
3
+
4
+ #Azure OpenAI APIs for completions and search
5
+
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
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module AzureOpenaiClient
17
+ # Input text to get embeddings for, encoded as a string. To get embeddings for multiple inputs in a single request, pass an array of strings. Each input must not exceed 2048 tokens in length. Unless you are embedding code, we suggest replacing newlines (\\n) in your input with a single space, as we have observed inferior results when newlines are present.
18
+ module EmbeddingsCreateRequestInput
19
+ class << self
20
+ # List of class defined in oneOf (OpenAPI v3)
21
+ def openapi_one_of
22
+ [
23
+ :'Array<String>',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of oneOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - We do not attempt to check whether exactly one item matches.
35
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
36
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
37
+ # - TODO: scalar values are de facto behaving as if they were nullable.
38
+ # - TODO: logging when debugging is set.
39
+ openapi_one_of.each do |klass|
40
+ begin
41
+ next if klass == :AnyType # "nullable: true"
42
+ typed_data = find_and_cast_into_type(klass, data)
43
+ return typed_data if typed_data
44
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
45
+ end
46
+ end
47
+
48
+ openapi_one_of.include?(:AnyType) ? data : nil
49
+ end
50
+
51
+ private
52
+
53
+ SchemaMismatchError = Class.new(StandardError)
54
+
55
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
56
+ def find_and_cast_into_type(klass, data)
57
+ return if data.nil?
58
+
59
+ case klass.to_s
60
+ when 'Boolean'
61
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
62
+ when 'Float'
63
+ return data if data.instance_of?(Float)
64
+ when 'Integer'
65
+ return data if data.instance_of?(Integer)
66
+ when 'Time'
67
+ return Time.parse(data)
68
+ when 'Date'
69
+ return Date.parse(data)
70
+ when 'String'
71
+ return data if data.instance_of?(String)
72
+ when 'Object' # "type: object"
73
+ return data if data.instance_of?(Hash)
74
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
75
+ if data.instance_of?(Array)
76
+ sub_type = Regexp.last_match[:sub_type]
77
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
78
+ end
79
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
80
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
81
+ sub_type = Regexp.last_match[:sub_type]
82
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
83
+ end
84
+ else # model
85
+ const = AzureOpenaiClient.const_get(klass)
86
+ if const
87
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
88
+ model = const.build(data)
89
+ return model if model
90
+ else
91
+ # raise if data contains keys that are not known to the model
92
+ raise unless (data.keys - const.acceptable_attributes).empty?
93
+ model = const.build_from_hash(data)
94
+ return model if model && model.valid?
95
+ end
96
+ end
97
+ end
98
+
99
+ raise # if no match by now, raise
100
+ rescue
101
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
102
+ end
103
+ end
104
+ end
105
+ end
@@ -1,17 +1,17 @@
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 spec version: 2023-05-15
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
17
  class ErrorResponse
@@ -20,14 +20,19 @@ module AzureOpenaiClient
20
20
  # Attribute mapping from ruby-style variable name to JSON key.
21
21
  def self.attribute_map
22
22
  {
23
- 'error': :'error'
23
+ :'error' => :'error'
24
24
  }
25
25
  end
26
26
 
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
27
32
  # Attribute type mapping.
28
33
  def self.openapi_types
29
34
  {
30
- 'error': :'Object'
35
+ :'error' => :'ErrorResponseError'
31
36
  }
32
37
  end
33
38
 
@@ -102,8 +107,11 @@ module AzureOpenaiClient
102
107
  # @return [Object] Returns the model itself
103
108
  def build_from_hash(attributes)
104
109
  return nil unless attributes.is_a?(Hash)
110
+ attributes = attributes.transform_keys(&:to_sym)
105
111
  self.class.openapi_types.each_pair do |key, type|
106
- if type =~ /\AArray<(.*)>/i
112
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
113
+ self.send("#{key}=", nil)
114
+ elsif type =~ /\AArray<(.*)>/i
107
115
  # check to ensure the input is an array given that the attribute
108
116
  # is documented as an array but the input is not
109
117
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -111,8 +119,6 @@ module AzureOpenaiClient
111
119
  end
112
120
  elsif !attributes[self.class.attribute_map[key]].nil?
113
121
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
- elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
115
- self.send("#{key}=", nil)
116
122
  end
117
123
  end
118
124
 
@@ -125,8 +131,8 @@ module AzureOpenaiClient
125
131
  # @return [Object] Deserialized data
126
132
  def _deserialize(type, value)
127
133
  case type.to_sym
128
- when :DateTime
129
- DateTime.parse(value)
134
+ when :Time
135
+ Time.parse(value)
130
136
  when :Date
131
137
  Date.parse(value)
132
138
  when :String
@@ -156,7 +162,9 @@ module AzureOpenaiClient
156
162
  end
157
163
  end
158
164
  else # model
159
- AzureOpenaiClient.const_get(type).build_from_hash(value)
165
+ # models (e.g. Pet) or oneOf
166
+ klass = AzureOpenaiClient.const_get(type)
167
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
160
168
  end
161
169
  end
162
170
 
@@ -1,17 +1,17 @@
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 spec version: 2023-05-15
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
17
  class ErrorResponseError
@@ -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
- 'code': :'code',
30
- 'message': :'message',
31
- 'param': :'param',
32
- 'type': :'type'
29
+ :'code' => :'code',
30
+ :'message' => :'message',
31
+ :'param' => :'param',
32
+ :'type' => :'type'
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
- 'code': :'Object',
40
- 'message': :'Object',
41
- 'param': :'Object',
42
- 'type': :'Object'
44
+ :'code' => :'String',
45
+ :'message' => :'String',
46
+ :'param' => :'String',
47
+ :'type' => :'String'
43
48
  }
44
49
  end
45
50
 
@@ -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 type =~ /\AArray<(.*)>/i
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 :DateTime
156
- DateTime.parse(value)
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
- AzureOpenaiClient.const_get(type).build_from_hash(value)
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,16 +1,15 @@
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 spec version: 2023-05-15
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
  module AzureOpenaiClient
15
- VERSION = '0.0.1'
14
+ VERSION = '0.0.3'
16
15
  end
@@ -1,14 +1,13 @@
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 spec version: 2023-05-15
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
  # Common files
@@ -18,26 +17,27 @@ require 'azure_openai_client/version'
18
17
  require 'azure_openai_client/configuration'
19
18
 
20
19
  # Models
21
- require 'azure_openai_client/models/chat_completions_body'
22
- require 'azure_openai_client/models/deploymentid_completions_body'
23
- require 'azure_openai_client/models/deploymentid_embeddings_body'
24
- require 'azure_openai_client/models/deploymentsdeploymentidchatcompletions_messages'
20
+ require 'azure_openai_client/models/chat_completions_create200_response'
21
+ require 'azure_openai_client/models/chat_completions_create200_response_choices_inner'
22
+ require 'azure_openai_client/models/chat_completions_create200_response_choices_inner_message'
23
+ require 'azure_openai_client/models/chat_completions_create200_response_usage'
24
+ require 'azure_openai_client/models/chat_completions_create_request'
25
+ require 'azure_openai_client/models/chat_completions_create_request_messages_inner'
26
+ require 'azure_openai_client/models/chat_completions_create_request_stop'
27
+ require 'azure_openai_client/models/completions_create200_response'
28
+ require 'azure_openai_client/models/completions_create200_response_choices_inner'
29
+ require 'azure_openai_client/models/completions_create200_response_choices_inner_logprobs'
30
+ require 'azure_openai_client/models/completions_create200_response_usage'
31
+ require 'azure_openai_client/models/completions_create_request'
32
+ require 'azure_openai_client/models/completions_create_request_prompt'
33
+ require 'azure_openai_client/models/completions_create_request_stop'
34
+ require 'azure_openai_client/models/embeddings_create200_response'
35
+ require 'azure_openai_client/models/embeddings_create200_response_data_inner'
36
+ require 'azure_openai_client/models/embeddings_create200_response_usage'
37
+ require 'azure_openai_client/models/embeddings_create_request'
38
+ require 'azure_openai_client/models/embeddings_create_request_input'
25
39
  require 'azure_openai_client/models/error_response'
26
40
  require 'azure_openai_client/models/error_response_error'
27
- require 'azure_openai_client/models/inline_response_200'
28
- require 'azure_openai_client/models/inline_response_200_1'
29
- require 'azure_openai_client/models/inline_response_200_1_data'
30
- require 'azure_openai_client/models/inline_response_200_1_usage'
31
- require 'azure_openai_client/models/inline_response_200_2'
32
- require 'azure_openai_client/models/inline_response_200_2_choices'
33
- require 'azure_openai_client/models/inline_response_200_2_message'
34
- require 'azure_openai_client/models/inline_response_200_2_usage'
35
- require 'azure_openai_client/models/inline_response_200_choices'
36
- require 'azure_openai_client/models/inline_response_200_logprobs'
37
- require 'azure_openai_client/models/inline_response_200_usage'
38
- require 'azure_openai_client/models/one_ofchat_completions_body_stop'
39
- require 'azure_openai_client/models/one_ofdeploymentid_completions_body_prompt'
40
- require 'azure_openai_client/models/one_ofdeploymentid_completions_body_stop'
41
41
 
42
42
  # APIs
43
43
  require 'azure_openai_client/api/default_api'
@@ -0,0 +1,12 @@
1
+ #!/bin/sh
2
+
3
+ gem_version=$1
4
+ release_notes=$2
5
+
6
+ openapi-generator generate -c openapi_config.yaml \
7
+ --additional-properties gemVersion="$gem_version",\
8
+ --release-note "$release_notes"
9
+
10
+
11
+ echo "Running Linter"
12
+ rubocop -A
@@ -0,0 +1,15 @@
1
+ inputSpec: inference.json
2
+ generatorName: ruby
3
+ outputDir: .
4
+ additionalProperties:
5
+ gemName: azure_openai_client
6
+ gemLicense: MIT
7
+ gemHomepage: "https://github.com/etsenake/azure-openai-client"
8
+ gemAuthor: "Josh Etsenake"
9
+ gemAuthorEmail: "josh.etsenake@fullscript.com"
10
+ hideGenerationTimestamp: true
11
+ gemRequiredRubyVersion: ">= 2.5"
12
+ gitUserId: etsenake
13
+ gitRepoId: azure-openai-client
14
+ globalProperties:
15
+ resolveFully: true