ragie_ruby_sdk 1.0.11 → 1.0.13

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 (206) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -4
  3. data/docs/AgentHoppsModelsModelsUsage.md +18 -0
  4. data/docs/Answer.md +20 -0
  5. data/docs/AnswerStep.md +26 -0
  6. data/docs/CodeInterpreterEvidence.md +26 -0
  7. data/docs/CodeStep.md +28 -0
  8. data/docs/EvaluatedAnswerStep.md +30 -0
  9. data/docs/FinalAnswer.md +24 -0
  10. data/docs/FinalAnswerEvidenceInner.md +40 -0
  11. data/docs/FinalAnswerStepsInner.md +42 -0
  12. data/docs/InputTokenDetails.md +18 -0
  13. data/docs/IntercomData.md +3 -1
  14. data/docs/ModelUsage.md +22 -0
  15. data/docs/OutputTokenDetails.md +18 -0
  16. data/docs/PlanStep.md +24 -0
  17. data/docs/RagieApiSchemaResponseUsage.md +26 -0
  18. data/docs/RagieEvidence.md +34 -0
  19. data/docs/Reasoning.md +20 -0
  20. data/docs/Request.md +28 -0
  21. data/docs/Response.md +62 -0
  22. data/docs/ResponseContent.md +22 -0
  23. data/docs/ResponseOutput.md +24 -0
  24. data/docs/ResponsesApi.md +147 -0
  25. data/docs/Search.md +18 -0
  26. data/docs/SearchResultLink.md +20 -0
  27. data/docs/SearchStep.md +24 -0
  28. data/docs/SurrenderStep.md +24 -0
  29. data/docs/Tool.md +20 -0
  30. data/lib/ragie_ruby_sdk/api/responses_api.rb +153 -0
  31. data/lib/ragie_ruby_sdk/models/agent_hopps_models_models_usage.rb +222 -0
  32. data/lib/ragie_ruby_sdk/models/answer.rb +265 -0
  33. data/lib/ragie_ruby_sdk/models/answer_step.rb +346 -0
  34. data/lib/ragie_ruby_sdk/models/code_interpreter_evidence.rb +360 -0
  35. data/lib/ragie_ruby_sdk/models/code_step.rb +359 -0
  36. data/lib/ragie_ruby_sdk/models/evaluated_answer_step.rb +398 -0
  37. data/lib/ragie_ruby_sdk/models/final_answer.rb +319 -0
  38. data/lib/ragie_ruby_sdk/models/final_answer_evidence_inner.rb +103 -0
  39. data/lib/ragie_ruby_sdk/models/final_answer_steps_inner.rb +107 -0
  40. data/lib/ragie_ruby_sdk/models/input_token_details.rb +222 -0
  41. data/lib/ragie_ruby_sdk/models/intercom_data.rb +14 -4
  42. data/lib/ragie_ruby_sdk/models/model_usage.rb +289 -0
  43. data/lib/ragie_ruby_sdk/models/output_token_details.rb +222 -0
  44. data/lib/ragie_ruby_sdk/models/plan_step.rb +336 -0
  45. data/lib/ragie_ruby_sdk/models/ragie_api_schema_response_usage.rb +307 -0
  46. data/lib/ragie_ruby_sdk/models/ragie_evidence.rb +419 -0
  47. data/lib/ragie_ruby_sdk/models/reasoning.rb +271 -0
  48. data/lib/ragie_ruby_sdk/models/request.rb +328 -0
  49. data/lib/ragie_ruby_sdk/models/response.rb +638 -0
  50. data/lib/ragie_ruby_sdk/models/response_content.rb +293 -0
  51. data/lib/ragie_ruby_sdk/models/response_output.rb +333 -0
  52. data/lib/ragie_ruby_sdk/models/search.rb +239 -0
  53. data/lib/ragie_ruby_sdk/models/search_result_link.rb +263 -0
  54. data/lib/ragie_ruby_sdk/models/search_step.rb +334 -0
  55. data/lib/ragie_ruby_sdk/models/surrender_step.rb +334 -0
  56. data/lib/ragie_ruby_sdk/models/tool.rb +289 -0
  57. data/lib/ragie_ruby_sdk/version.rb +1 -1
  58. data/lib/ragie_ruby_sdk.rb +26 -0
  59. data/spec/api/responses_api_spec.rb +59 -0
  60. data/spec/models/access_token_credentials_spec.rb +1 -1
  61. data/spec/models/agent_hopps_models_models_usage_spec.rb +36 -0
  62. data/spec/models/answer_spec.rb +42 -0
  63. data/spec/models/answer_step_spec.rb +64 -0
  64. data/spec/models/async_document_metadata_update_spec.rb +1 -1
  65. data/spec/models/audio_modality_data_spec.rb +1 -1
  66. data/spec/models/authenticator_confluence_connection_spec.rb +1 -1
  67. data/spec/models/authenticator_dropbox_connection_spec.rb +1 -1
  68. data/spec/models/authenticator_gmail_connection_spec.rb +1 -1
  69. data/spec/models/authenticator_google_drive_connection_spec.rb +1 -1
  70. data/spec/models/authenticator_hubspot_connection_spec.rb +1 -1
  71. data/spec/models/authenticator_jira_connection_spec.rb +1 -1
  72. data/spec/models/authenticator_list_spec.rb +1 -1
  73. data/spec/models/authenticator_notion_connection_spec.rb +1 -1
  74. data/spec/models/authenticator_onedrive_connection_spec.rb +1 -1
  75. data/spec/models/authenticator_salesforce_connection_spec.rb +1 -1
  76. data/spec/models/authenticator_sharepoint_connection_spec.rb +1 -1
  77. data/spec/models/authenticator_slack_connection_spec.rb +1 -1
  78. data/spec/models/backblaze_credentials_spec.rb +1 -1
  79. data/spec/models/base_get_authenticator_spec.rb +1 -1
  80. data/spec/models/body_create_document_spec.rb +1 -1
  81. data/spec/models/body_update_document_file_spec.rb +1 -1
  82. data/spec/models/bucket_data_spec.rb +1 -1
  83. data/spec/models/code_interpreter_evidence_spec.rb +64 -0
  84. data/spec/models/code_step_spec.rb +70 -0
  85. data/spec/models/confluence_data_spec.rb +1 -1
  86. data/spec/models/connection_base_spec.rb +1 -1
  87. data/spec/models/connection_limit_exceeded_webhook_payload_spec.rb +1 -1
  88. data/spec/models/connection_limit_exceeded_webhook_spec.rb +1 -1
  89. data/spec/models/connection_limit_params_spec.rb +1 -1
  90. data/spec/models/connection_list_spec.rb +1 -1
  91. data/spec/models/connection_spec.rb +1 -1
  92. data/spec/models/connection_stats_spec.rb +1 -1
  93. data/spec/models/connection_sync_finished_webhook_payload_spec.rb +1 -1
  94. data/spec/models/connection_sync_finished_webhook_spec.rb +1 -1
  95. data/spec/models/connection_sync_progress_webhook_payload_spec.rb +1 -1
  96. data/spec/models/connection_sync_progress_webhook_spec.rb +1 -1
  97. data/spec/models/connection_sync_started_webhook_payload_spec.rb +1 -1
  98. data/spec/models/connection_sync_started_webhook_spec.rb +1 -1
  99. data/spec/models/connector_source_spec.rb +1 -1
  100. data/spec/models/connector_source_type_info_spec.rb +1 -1
  101. data/spec/models/create_authenticator_connection_spec.rb +1 -1
  102. data/spec/models/create_document_from_url_params_spec.rb +1 -1
  103. data/spec/models/create_document_raw_params_spec.rb +1 -1
  104. data/spec/models/create_google_authenticator_spec.rb +1 -1
  105. data/spec/models/create_instruction_params_spec.rb +1 -1
  106. data/spec/models/create_partition_params_spec.rb +1 -1
  107. data/spec/models/delete_connection_payload_spec.rb +1 -1
  108. data/spec/models/document_chunk_detail_spec.rb +1 -1
  109. data/spec/models/document_chunk_list_spec.rb +1 -1
  110. data/spec/models/document_chunk_spec.rb +1 -1
  111. data/spec/models/document_delete_spec.rb +1 -1
  112. data/spec/models/document_delete_webhook_payload_spec.rb +1 -1
  113. data/spec/models/document_delete_webhook_spec.rb +1 -1
  114. data/spec/models/document_file_update_spec.rb +1 -1
  115. data/spec/models/document_get_spec.rb +1 -1
  116. data/spec/models/document_list_spec.rb +1 -1
  117. data/spec/models/document_metadata_update_spec.rb +1 -1
  118. data/spec/models/document_raw_update_spec.rb +1 -1
  119. data/spec/models/document_spec.rb +1 -1
  120. data/spec/models/document_summary_spec.rb +1 -1
  121. data/spec/models/document_update_webhook_payload_spec.rb +1 -1
  122. data/spec/models/document_update_webhook_spec.rb +1 -1
  123. data/spec/models/document_url_update_spec.rb +1 -1
  124. data/spec/models/document_with_content_spec.rb +1 -1
  125. data/spec/models/entity_extracted_webhook_payload_spec.rb +1 -1
  126. data/spec/models/entity_extracted_webhook_spec.rb +1 -1
  127. data/spec/models/entity_list_spec.rb +1 -1
  128. data/spec/models/entity_spec.rb +1 -1
  129. data/spec/models/error_message_spec.rb +1 -1
  130. data/spec/models/evaluated_answer_step_spec.rb +76 -0
  131. data/spec/models/final_answer_evidence_inner_spec.rb +21 -0
  132. data/spec/models/final_answer_spec.rb +54 -0
  133. data/spec/models/final_answer_steps_inner_spec.rb +21 -0
  134. data/spec/models/folder_data_spec.rb +1 -1
  135. data/spec/models/freshdesk_credentials_spec.rb +1 -1
  136. data/spec/models/freshdesk_data_spec.rb +1 -1
  137. data/spec/models/gmail_data_spec.rb +1 -1
  138. data/spec/models/google_folder_data_spec.rb +1 -1
  139. data/spec/models/http_validation_error_spec.rb +1 -1
  140. data/spec/models/hubspot_data_spec.rb +1 -1
  141. data/spec/models/input_token_details_spec.rb +36 -0
  142. data/spec/models/instruction_spec.rb +1 -1
  143. data/spec/models/intercom_credentials_spec.rb +1 -1
  144. data/spec/models/intercom_data_spec.rb +7 -1
  145. data/spec/models/link_spec.rb +1 -1
  146. data/spec/models/list_connector_source_type_info_spec.rb +1 -1
  147. data/spec/models/media_mode_param_spec.rb +1 -1
  148. data/spec/models/mode2_one_of_spec.rb +1 -1
  149. data/spec/models/model_usage_spec.rb +48 -0
  150. data/spec/models/o_auth_credentials_spec.rb +1 -1
  151. data/spec/models/o_auth_refresh_token_credentials_spec.rb +1 -1
  152. data/spec/models/o_auth_url_create_spec.rb +1 -1
  153. data/spec/models/o_auth_url_response_spec.rb +1 -1
  154. data/spec/models/onedrive_data_spec.rb +1 -1
  155. data/spec/models/output_token_details_spec.rb +36 -0
  156. data/spec/models/pagination_spec.rb +1 -1
  157. data/spec/models/partition_detail_spec.rb +1 -1
  158. data/spec/models/partition_limit_exceeded_webhook_payload_spec.rb +1 -1
  159. data/spec/models/partition_limit_exceeded_webhook_spec.rb +1 -1
  160. data/spec/models/partition_limit_params_spec.rb +1 -1
  161. data/spec/models/partition_limit_reset_webhook_payload_spec.rb +1 -1
  162. data/spec/models/partition_limit_reset_webhook_spec.rb +1 -1
  163. data/spec/models/partition_limits_spec.rb +1 -1
  164. data/spec/models/partition_list_spec.rb +1 -1
  165. data/spec/models/partition_spec.rb +1 -1
  166. data/spec/models/partition_stats_spec.rb +1 -1
  167. data/spec/models/patch_document_metadata_params_spec.rb +1 -1
  168. data/spec/models/plan_step_spec.rb +58 -0
  169. data/spec/models/public_backblaze_connection_spec.rb +1 -1
  170. data/spec/models/public_create_connection_spec.rb +1 -1
  171. data/spec/models/public_freshdesk_connection_spec.rb +1 -1
  172. data/spec/models/public_gcs_connection_spec.rb +1 -1
  173. data/spec/models/public_intercom_connection_spec.rb +1 -1
  174. data/spec/models/public_s3_compatible_connection_spec.rb +1 -1
  175. data/spec/models/public_zendesk_connection_spec.rb +1 -1
  176. data/spec/models/ragie_api_schema_response_usage_spec.rb +60 -0
  177. data/spec/models/ragie_evidence_spec.rb +88 -0
  178. data/spec/models/reasoning_spec.rb +46 -0
  179. data/spec/models/request_spec.rb +70 -0
  180. data/spec/models/response_content_spec.rb +52 -0
  181. data/spec/models/response_ok_spec.rb +1 -1
  182. data/spec/models/response_output_spec.rb +62 -0
  183. data/spec/models/response_spec.rb +188 -0
  184. data/spec/models/retrieval_spec.rb +1 -1
  185. data/spec/models/retrieve_params_spec.rb +1 -1
  186. data/spec/models/s3_compatible_credentials_spec.rb +1 -1
  187. data/spec/models/scored_chunk_spec.rb +1 -1
  188. data/spec/models/search_result_link_spec.rb +42 -0
  189. data/spec/models/search_spec.rb +36 -0
  190. data/spec/models/search_step_spec.rb +58 -0
  191. data/spec/models/set_connection_enabled_payload_spec.rb +1 -1
  192. data/spec/models/sharepoint_data_spec.rb +1 -1
  193. data/spec/models/sharepoint_file_data_spec.rb +1 -1
  194. data/spec/models/sharepoint_site_data_spec.rb +1 -1
  195. data/spec/models/slack_data_spec.rb +1 -1
  196. data/spec/models/surrender_step_spec.rb +58 -0
  197. data/spec/models/tool_spec.rb +46 -0
  198. data/spec/models/update_document_from_url_params_spec.rb +1 -1
  199. data/spec/models/update_document_raw_params_spec.rb +1 -1
  200. data/spec/models/update_instruction_params_spec.rb +1 -1
  201. data/spec/models/validation_error_spec.rb +1 -1
  202. data/spec/models/video_modality_data_spec.rb +1 -1
  203. data/spec/models/word_timestamp_spec.rb +1 -1
  204. data/spec/models/zendesk_credentials_spec.rb +1 -1
  205. data/spec/models/zendesk_data_spec.rb +1 -1
  206. metadata +105 -1
@@ -0,0 +1,293 @@
1
+ =begin
2
+ #Ragie API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.16.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module RagieRubySdk
17
+ class ResponseContent
18
+ attr_accessor :type
19
+
20
+ attr_accessor :text
21
+
22
+ attr_accessor :annotations
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'type' => :'type',
50
+ :'text' => :'text',
51
+ :'annotations' => :'annotations'
52
+ }
53
+ end
54
+
55
+ # Returns attribute mapping this model knows about
56
+ def self.acceptable_attribute_map
57
+ attribute_map
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ acceptable_attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'type' => :'String',
69
+ :'text' => :'String',
70
+ :'annotations' => :'Array<Hash<String, Object>>'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RagieRubySdk::ResponseContent` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ acceptable_attribute_map = self.class.acceptable_attribute_map
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!acceptable_attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RagieRubySdk::ResponseContent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'type')
97
+ self.type = attributes[:'type']
98
+ else
99
+ self.type = 'text'
100
+ end
101
+
102
+ if attributes.key?(:'text')
103
+ self.text = attributes[:'text']
104
+ else
105
+ self.text = nil
106
+ end
107
+
108
+ if attributes.key?(:'annotations')
109
+ if (value = attributes[:'annotations']).is_a?(Array)
110
+ self.annotations = value
111
+ end
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
+ invalid_properties = Array.new
120
+ if @text.nil?
121
+ invalid_properties.push('invalid value for "text", text cannot be nil.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
131
+ type_validator = EnumAttributeValidator.new('String', ["text"])
132
+ return false unless type_validator.valid?(@type)
133
+ return false if @text.nil?
134
+ true
135
+ end
136
+
137
+ # Custom attribute writer method checking allowed values (enum).
138
+ # @param [Object] type Object to be assigned
139
+ def type=(type)
140
+ validator = EnumAttributeValidator.new('String', ["text"])
141
+ unless validator.valid?(type)
142
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
143
+ end
144
+ @type = type
145
+ end
146
+
147
+ # Custom attribute writer method with validation
148
+ # @param [Object] text Value to be assigned
149
+ def text=(text)
150
+ if text.nil?
151
+ fail ArgumentError, 'text cannot be nil'
152
+ end
153
+
154
+ @text = text
155
+ end
156
+
157
+ # Checks equality by comparing each attribute.
158
+ # @param [Object] Object to be compared
159
+ def ==(o)
160
+ return true if self.equal?(o)
161
+ self.class == o.class &&
162
+ type == o.type &&
163
+ text == o.text &&
164
+ annotations == o.annotations
165
+ end
166
+
167
+ # @see the `==` method
168
+ # @param [Object] Object to be compared
169
+ def eql?(o)
170
+ self == o
171
+ end
172
+
173
+ # Calculates hash code according to all attributes.
174
+ # @return [Integer] Hash code
175
+ def hash
176
+ [type, text, annotations].hash
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def self.build_from_hash(attributes)
183
+ return nil unless attributes.is_a?(Hash)
184
+ attributes = attributes.transform_keys(&:to_sym)
185
+ transformed_hash = {}
186
+ openapi_types.each_pair do |key, type|
187
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
188
+ transformed_hash["#{key}"] = nil
189
+ elsif type =~ /\AArray<(.*)>/i
190
+ # check to ensure the input is an array given that the attribute
191
+ # is documented as an array but the input is not
192
+ if attributes[attribute_map[key]].is_a?(Array)
193
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
194
+ end
195
+ elsif !attributes[attribute_map[key]].nil?
196
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
197
+ end
198
+ end
199
+ new(transformed_hash)
200
+ end
201
+
202
+ # Deserializes the data based on type
203
+ # @param string type Data type
204
+ # @param string value Value to be deserialized
205
+ # @return [Object] Deserialized data
206
+ def self._deserialize(type, value)
207
+ case type.to_sym
208
+ when :Time
209
+ Time.parse(value)
210
+ when :Date
211
+ Date.parse(value)
212
+ when :String
213
+ value.to_s
214
+ when :Integer
215
+ value.to_i
216
+ when :Float
217
+ value.to_f
218
+ when :Boolean
219
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
220
+ true
221
+ else
222
+ false
223
+ end
224
+ when :Object
225
+ # generic object (usually a Hash), return directly
226
+ value
227
+ when /\AArray<(?<inner_type>.+)>\z/
228
+ inner_type = Regexp.last_match[:inner_type]
229
+ value.map { |v| _deserialize(inner_type, v) }
230
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
231
+ k_type = Regexp.last_match[:k_type]
232
+ v_type = Regexp.last_match[:v_type]
233
+ {}.tap do |hash|
234
+ value.each do |k, v|
235
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
236
+ end
237
+ end
238
+ else # model
239
+ # models (e.g. Pet) or oneOf
240
+ klass = RagieRubySdk.const_get(type)
241
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
242
+ end
243
+ end
244
+
245
+ # Returns the string representation of the object
246
+ # @return [String] String presentation of the object
247
+ def to_s
248
+ to_hash.to_s
249
+ end
250
+
251
+ # to_body is an alias to to_hash (backward compatibility)
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_body
254
+ to_hash
255
+ end
256
+
257
+ # Returns the object in the form of hash
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_hash
260
+ hash = {}
261
+ self.class.attribute_map.each_pair do |attr, param|
262
+ value = self.send(attr)
263
+ if value.nil?
264
+ is_nullable = self.class.openapi_nullable.include?(attr)
265
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
266
+ end
267
+
268
+ hash[param] = _to_hash(value)
269
+ end
270
+ hash
271
+ end
272
+
273
+ # Outputs non-array value in the form of hash
274
+ # For object, use to_hash. Otherwise, just return the value
275
+ # @param [Object] value Any valid value
276
+ # @return [Hash] Returns the value in the form of hash
277
+ def _to_hash(value)
278
+ if value.is_a?(Array)
279
+ value.compact.map { |v| _to_hash(v) }
280
+ elsif value.is_a?(Hash)
281
+ {}.tap do |hash|
282
+ value.each { |k, v| hash[k] = _to_hash(v) }
283
+ end
284
+ elsif value.respond_to? :to_hash
285
+ value.to_hash
286
+ else
287
+ value
288
+ end
289
+ end
290
+
291
+ end
292
+
293
+ end
@@ -0,0 +1,333 @@
1
+ =begin
2
+ #Ragie API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.16.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module RagieRubySdk
17
+ class ResponseOutput
18
+ attr_accessor :type
19
+
20
+ attr_accessor :id
21
+
22
+ attr_accessor :role
23
+
24
+ attr_accessor :content
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'type' => :'type',
52
+ :'id' => :'id',
53
+ :'role' => :'role',
54
+ :'content' => :'content'
55
+ }
56
+ end
57
+
58
+ # Returns attribute mapping this model knows about
59
+ def self.acceptable_attribute_map
60
+ attribute_map
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ acceptable_attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'type' => :'String',
72
+ :'id' => :'String',
73
+ :'role' => :'String',
74
+ :'content' => :'Array<ResponseContent>'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RagieRubySdk::ResponseOutput` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ acceptable_attribute_map = self.class.acceptable_attribute_map
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!acceptable_attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RagieRubySdk::ResponseOutput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'type')
101
+ self.type = attributes[:'type']
102
+ else
103
+ self.type = 'message'
104
+ end
105
+
106
+ if attributes.key?(:'id')
107
+ self.id = attributes[:'id']
108
+ else
109
+ self.id = nil
110
+ end
111
+
112
+ if attributes.key?(:'role')
113
+ self.role = attributes[:'role']
114
+ else
115
+ self.role = 'assistant'
116
+ end
117
+
118
+ if attributes.key?(:'content')
119
+ if (value = attributes[:'content']).is_a?(Array)
120
+ self.content = value
121
+ end
122
+ else
123
+ self.content = nil
124
+ end
125
+ end
126
+
127
+ # Show invalid properties with the reasons. Usually used together with valid?
128
+ # @return Array for valid properties with the reasons
129
+ def list_invalid_properties
130
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
131
+ invalid_properties = Array.new
132
+ if @id.nil?
133
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
134
+ end
135
+
136
+ if @content.nil?
137
+ invalid_properties.push('invalid value for "content", content cannot be nil.')
138
+ end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ warn '[DEPRECATED] the `valid?` method is obsolete'
147
+ type_validator = EnumAttributeValidator.new('String', ["message"])
148
+ return false unless type_validator.valid?(@type)
149
+ return false if @id.nil?
150
+ role_validator = EnumAttributeValidator.new('String', ["assistant"])
151
+ return false unless role_validator.valid?(@role)
152
+ return false if @content.nil?
153
+ true
154
+ end
155
+
156
+ # Custom attribute writer method checking allowed values (enum).
157
+ # @param [Object] type Object to be assigned
158
+ def type=(type)
159
+ validator = EnumAttributeValidator.new('String', ["message"])
160
+ unless validator.valid?(type)
161
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
162
+ end
163
+ @type = type
164
+ end
165
+
166
+ # Custom attribute writer method with validation
167
+ # @param [Object] id Value to be assigned
168
+ def id=(id)
169
+ if id.nil?
170
+ fail ArgumentError, 'id cannot be nil'
171
+ end
172
+
173
+ @id = id
174
+ end
175
+
176
+ # Custom attribute writer method checking allowed values (enum).
177
+ # @param [Object] role Object to be assigned
178
+ def role=(role)
179
+ validator = EnumAttributeValidator.new('String', ["assistant"])
180
+ unless validator.valid?(role)
181
+ fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
182
+ end
183
+ @role = role
184
+ end
185
+
186
+ # Custom attribute writer method with validation
187
+ # @param [Object] content Value to be assigned
188
+ def content=(content)
189
+ if content.nil?
190
+ fail ArgumentError, 'content cannot be nil'
191
+ end
192
+
193
+ @content = content
194
+ end
195
+
196
+ # Checks equality by comparing each attribute.
197
+ # @param [Object] Object to be compared
198
+ def ==(o)
199
+ return true if self.equal?(o)
200
+ self.class == o.class &&
201
+ type == o.type &&
202
+ id == o.id &&
203
+ role == o.role &&
204
+ content == o.content
205
+ end
206
+
207
+ # @see the `==` method
208
+ # @param [Object] Object to be compared
209
+ def eql?(o)
210
+ self == o
211
+ end
212
+
213
+ # Calculates hash code according to all attributes.
214
+ # @return [Integer] Hash code
215
+ def hash
216
+ [type, id, role, content].hash
217
+ end
218
+
219
+ # Builds the object from hash
220
+ # @param [Hash] attributes Model attributes in the form of hash
221
+ # @return [Object] Returns the model itself
222
+ def self.build_from_hash(attributes)
223
+ return nil unless attributes.is_a?(Hash)
224
+ attributes = attributes.transform_keys(&:to_sym)
225
+ transformed_hash = {}
226
+ openapi_types.each_pair do |key, type|
227
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
228
+ transformed_hash["#{key}"] = nil
229
+ elsif type =~ /\AArray<(.*)>/i
230
+ # check to ensure the input is an array given that the attribute
231
+ # is documented as an array but the input is not
232
+ if attributes[attribute_map[key]].is_a?(Array)
233
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
234
+ end
235
+ elsif !attributes[attribute_map[key]].nil?
236
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
237
+ end
238
+ end
239
+ new(transformed_hash)
240
+ end
241
+
242
+ # Deserializes the data based on type
243
+ # @param string type Data type
244
+ # @param string value Value to be deserialized
245
+ # @return [Object] Deserialized data
246
+ def self._deserialize(type, value)
247
+ case type.to_sym
248
+ when :Time
249
+ Time.parse(value)
250
+ when :Date
251
+ Date.parse(value)
252
+ when :String
253
+ value.to_s
254
+ when :Integer
255
+ value.to_i
256
+ when :Float
257
+ value.to_f
258
+ when :Boolean
259
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
260
+ true
261
+ else
262
+ false
263
+ end
264
+ when :Object
265
+ # generic object (usually a Hash), return directly
266
+ value
267
+ when /\AArray<(?<inner_type>.+)>\z/
268
+ inner_type = Regexp.last_match[:inner_type]
269
+ value.map { |v| _deserialize(inner_type, v) }
270
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
271
+ k_type = Regexp.last_match[:k_type]
272
+ v_type = Regexp.last_match[:v_type]
273
+ {}.tap do |hash|
274
+ value.each do |k, v|
275
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
276
+ end
277
+ end
278
+ else # model
279
+ # models (e.g. Pet) or oneOf
280
+ klass = RagieRubySdk.const_get(type)
281
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
282
+ end
283
+ end
284
+
285
+ # Returns the string representation of the object
286
+ # @return [String] String presentation of the object
287
+ def to_s
288
+ to_hash.to_s
289
+ end
290
+
291
+ # to_body is an alias to to_hash (backward compatibility)
292
+ # @return [Hash] Returns the object in the form of hash
293
+ def to_body
294
+ to_hash
295
+ end
296
+
297
+ # Returns the object in the form of hash
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_hash
300
+ hash = {}
301
+ self.class.attribute_map.each_pair do |attr, param|
302
+ value = self.send(attr)
303
+ if value.nil?
304
+ is_nullable = self.class.openapi_nullable.include?(attr)
305
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
306
+ end
307
+
308
+ hash[param] = _to_hash(value)
309
+ end
310
+ hash
311
+ end
312
+
313
+ # Outputs non-array value in the form of hash
314
+ # For object, use to_hash. Otherwise, just return the value
315
+ # @param [Object] value Any valid value
316
+ # @return [Hash] Returns the value in the form of hash
317
+ def _to_hash(value)
318
+ if value.is_a?(Array)
319
+ value.compact.map { |v| _to_hash(v) }
320
+ elsif value.is_a?(Hash)
321
+ {}.tap do |hash|
322
+ value.each { |k, v| hash[k] = _to_hash(v) }
323
+ end
324
+ elsif value.respond_to? :to_hash
325
+ value.to_hash
326
+ else
327
+ value
328
+ end
329
+ end
330
+
331
+ end
332
+
333
+ end