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,346 @@
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 AnswerStep
18
+ attr_accessor :type
19
+
20
+ attr_accessor :think
21
+
22
+ attr_accessor :current_question
23
+
24
+ # A list of question ids that are no longer relevant to the current answer referenced by their IDs.
25
+ attr_accessor :other_resolved_question_ids
26
+
27
+ attr_accessor :answer
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'type' => :'type',
55
+ :'think' => :'think',
56
+ :'current_question' => :'current_question',
57
+ :'other_resolved_question_ids' => :'other_resolved_question_ids',
58
+ :'answer' => :'answer'
59
+ }
60
+ end
61
+
62
+ # Returns attribute mapping this model knows about
63
+ def self.acceptable_attribute_map
64
+ attribute_map
65
+ end
66
+
67
+ # Returns all the JSON keys this model knows about
68
+ def self.acceptable_attributes
69
+ acceptable_attribute_map.values
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.openapi_types
74
+ {
75
+ :'type' => :'String',
76
+ :'think' => :'String',
77
+ :'current_question' => :'String',
78
+ :'other_resolved_question_ids' => :'Array<String>',
79
+ :'answer' => :'Answer'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ ])
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RagieRubySdk::AnswerStep` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ acceptable_attribute_map = self.class.acceptable_attribute_map
98
+ attributes = attributes.each_with_object({}) { |(k, v), h|
99
+ if (!acceptable_attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RagieRubySdk::AnswerStep`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
101
+ end
102
+ h[k.to_sym] = v
103
+ }
104
+
105
+ if attributes.key?(:'type')
106
+ self.type = attributes[:'type']
107
+ else
108
+ self.type = 'answer'
109
+ end
110
+
111
+ if attributes.key?(:'think')
112
+ self.think = attributes[:'think']
113
+ else
114
+ self.think = nil
115
+ end
116
+
117
+ if attributes.key?(:'current_question')
118
+ self.current_question = attributes[:'current_question']
119
+ else
120
+ self.current_question = nil
121
+ end
122
+
123
+ if attributes.key?(:'other_resolved_question_ids')
124
+ if (value = attributes[:'other_resolved_question_ids']).is_a?(Array)
125
+ self.other_resolved_question_ids = value
126
+ end
127
+ end
128
+
129
+ if attributes.key?(:'answer')
130
+ self.answer = attributes[:'answer']
131
+ else
132
+ self.answer = nil
133
+ end
134
+ end
135
+
136
+ # Show invalid properties with the reasons. Usually used together with valid?
137
+ # @return Array for valid properties with the reasons
138
+ def list_invalid_properties
139
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
140
+ invalid_properties = Array.new
141
+ if @think.nil?
142
+ invalid_properties.push('invalid value for "think", think cannot be nil.')
143
+ end
144
+
145
+ if @current_question.nil?
146
+ invalid_properties.push('invalid value for "current_question", current_question cannot be nil.')
147
+ end
148
+
149
+ if @answer.nil?
150
+ invalid_properties.push('invalid value for "answer", answer cannot be nil.')
151
+ end
152
+
153
+ invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ warn '[DEPRECATED] the `valid?` method is obsolete'
160
+ type_validator = EnumAttributeValidator.new('String', ["answer"])
161
+ return false unless type_validator.valid?(@type)
162
+ return false if @think.nil?
163
+ return false if @current_question.nil?
164
+ return false if @answer.nil?
165
+ true
166
+ end
167
+
168
+ # Custom attribute writer method checking allowed values (enum).
169
+ # @param [Object] type Object to be assigned
170
+ def type=(type)
171
+ validator = EnumAttributeValidator.new('String', ["answer"])
172
+ unless validator.valid?(type)
173
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
174
+ end
175
+ @type = type
176
+ end
177
+
178
+ # Custom attribute writer method with validation
179
+ # @param [Object] think Value to be assigned
180
+ def think=(think)
181
+ if think.nil?
182
+ fail ArgumentError, 'think cannot be nil'
183
+ end
184
+
185
+ @think = think
186
+ end
187
+
188
+ # Custom attribute writer method with validation
189
+ # @param [Object] current_question Value to be assigned
190
+ def current_question=(current_question)
191
+ if current_question.nil?
192
+ fail ArgumentError, 'current_question cannot be nil'
193
+ end
194
+
195
+ @current_question = current_question
196
+ end
197
+
198
+ # Custom attribute writer method with validation
199
+ # @param [Object] answer Value to be assigned
200
+ def answer=(answer)
201
+ if answer.nil?
202
+ fail ArgumentError, 'answer cannot be nil'
203
+ end
204
+
205
+ @answer = answer
206
+ end
207
+
208
+ # Checks equality by comparing each attribute.
209
+ # @param [Object] Object to be compared
210
+ def ==(o)
211
+ return true if self.equal?(o)
212
+ self.class == o.class &&
213
+ type == o.type &&
214
+ think == o.think &&
215
+ current_question == o.current_question &&
216
+ other_resolved_question_ids == o.other_resolved_question_ids &&
217
+ answer == o.answer
218
+ end
219
+
220
+ # @see the `==` method
221
+ # @param [Object] Object to be compared
222
+ def eql?(o)
223
+ self == o
224
+ end
225
+
226
+ # Calculates hash code according to all attributes.
227
+ # @return [Integer] Hash code
228
+ def hash
229
+ [type, think, current_question, other_resolved_question_ids, answer].hash
230
+ end
231
+
232
+ # Builds the object from hash
233
+ # @param [Hash] attributes Model attributes in the form of hash
234
+ # @return [Object] Returns the model itself
235
+ def self.build_from_hash(attributes)
236
+ return nil unless attributes.is_a?(Hash)
237
+ attributes = attributes.transform_keys(&:to_sym)
238
+ transformed_hash = {}
239
+ openapi_types.each_pair do |key, type|
240
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
241
+ transformed_hash["#{key}"] = nil
242
+ elsif type =~ /\AArray<(.*)>/i
243
+ # check to ensure the input is an array given that the attribute
244
+ # is documented as an array but the input is not
245
+ if attributes[attribute_map[key]].is_a?(Array)
246
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
247
+ end
248
+ elsif !attributes[attribute_map[key]].nil?
249
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
250
+ end
251
+ end
252
+ new(transformed_hash)
253
+ end
254
+
255
+ # Deserializes the data based on type
256
+ # @param string type Data type
257
+ # @param string value Value to be deserialized
258
+ # @return [Object] Deserialized data
259
+ def self._deserialize(type, value)
260
+ case type.to_sym
261
+ when :Time
262
+ Time.parse(value)
263
+ when :Date
264
+ Date.parse(value)
265
+ when :String
266
+ value.to_s
267
+ when :Integer
268
+ value.to_i
269
+ when :Float
270
+ value.to_f
271
+ when :Boolean
272
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
273
+ true
274
+ else
275
+ false
276
+ end
277
+ when :Object
278
+ # generic object (usually a Hash), return directly
279
+ value
280
+ when /\AArray<(?<inner_type>.+)>\z/
281
+ inner_type = Regexp.last_match[:inner_type]
282
+ value.map { |v| _deserialize(inner_type, v) }
283
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
284
+ k_type = Regexp.last_match[:k_type]
285
+ v_type = Regexp.last_match[:v_type]
286
+ {}.tap do |hash|
287
+ value.each do |k, v|
288
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
289
+ end
290
+ end
291
+ else # model
292
+ # models (e.g. Pet) or oneOf
293
+ klass = RagieRubySdk.const_get(type)
294
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
295
+ end
296
+ end
297
+
298
+ # Returns the string representation of the object
299
+ # @return [String] String presentation of the object
300
+ def to_s
301
+ to_hash.to_s
302
+ end
303
+
304
+ # to_body is an alias to to_hash (backward compatibility)
305
+ # @return [Hash] Returns the object in the form of hash
306
+ def to_body
307
+ to_hash
308
+ end
309
+
310
+ # Returns the object in the form of hash
311
+ # @return [Hash] Returns the object in the form of hash
312
+ def to_hash
313
+ hash = {}
314
+ self.class.attribute_map.each_pair do |attr, param|
315
+ value = self.send(attr)
316
+ if value.nil?
317
+ is_nullable = self.class.openapi_nullable.include?(attr)
318
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
319
+ end
320
+
321
+ hash[param] = _to_hash(value)
322
+ end
323
+ hash
324
+ end
325
+
326
+ # Outputs non-array value in the form of hash
327
+ # For object, use to_hash. Otherwise, just return the value
328
+ # @param [Object] value Any valid value
329
+ # @return [Hash] Returns the value in the form of hash
330
+ def _to_hash(value)
331
+ if value.is_a?(Array)
332
+ value.compact.map { |v| _to_hash(v) }
333
+ elsif value.is_a?(Hash)
334
+ {}.tap do |hash|
335
+ value.each { |k, v| hash[k] = _to_hash(v) }
336
+ end
337
+ elsif value.respond_to? :to_hash
338
+ value.to_hash
339
+ else
340
+ value
341
+ end
342
+ end
343
+
344
+ end
345
+
346
+ end
@@ -0,0 +1,360 @@
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 CodeInterpreterEvidence
18
+ attr_accessor :type
19
+
20
+ attr_accessor :text
21
+
22
+ attr_accessor :code
23
+
24
+ attr_accessor :code_issue
25
+
26
+ attr_accessor :code_result
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'type' => :'type',
54
+ :'text' => :'text',
55
+ :'code' => :'code',
56
+ :'code_issue' => :'code_issue',
57
+ :'code_result' => :'code_result'
58
+ }
59
+ end
60
+
61
+ # Returns attribute mapping this model knows about
62
+ def self.acceptable_attribute_map
63
+ attribute_map
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ acceptable_attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'type' => :'String',
75
+ :'text' => :'String',
76
+ :'code' => :'String',
77
+ :'code_issue' => :'String',
78
+ :'code_result' => :'String'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RagieRubySdk::CodeInterpreterEvidence` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ acceptable_attribute_map = self.class.acceptable_attribute_map
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!acceptable_attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RagieRubySdk::CodeInterpreterEvidence`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'type')
105
+ self.type = attributes[:'type']
106
+ else
107
+ self.type = 'code_interpreter'
108
+ end
109
+
110
+ if attributes.key?(:'text')
111
+ self.text = attributes[:'text']
112
+ else
113
+ self.text = nil
114
+ end
115
+
116
+ if attributes.key?(:'code')
117
+ self.code = attributes[:'code']
118
+ else
119
+ self.code = nil
120
+ end
121
+
122
+ if attributes.key?(:'code_issue')
123
+ self.code_issue = attributes[:'code_issue']
124
+ else
125
+ self.code_issue = nil
126
+ end
127
+
128
+ if attributes.key?(:'code_result')
129
+ self.code_result = attributes[:'code_result']
130
+ else
131
+ self.code_result = nil
132
+ end
133
+ end
134
+
135
+ # Show invalid properties with the reasons. Usually used together with valid?
136
+ # @return Array for valid properties with the reasons
137
+ def list_invalid_properties
138
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
139
+ invalid_properties = Array.new
140
+ if @text.nil?
141
+ invalid_properties.push('invalid value for "text", text cannot be nil.')
142
+ end
143
+
144
+ if @code.nil?
145
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
146
+ end
147
+
148
+ if @code_issue.nil?
149
+ invalid_properties.push('invalid value for "code_issue", code_issue cannot be nil.')
150
+ end
151
+
152
+ if @code_result.nil?
153
+ invalid_properties.push('invalid value for "code_result", code_result cannot be nil.')
154
+ end
155
+
156
+ invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ warn '[DEPRECATED] the `valid?` method is obsolete'
163
+ type_validator = EnumAttributeValidator.new('String', ["code_interpreter"])
164
+ return false unless type_validator.valid?(@type)
165
+ return false if @text.nil?
166
+ return false if @code.nil?
167
+ return false if @code_issue.nil?
168
+ return false if @code_result.nil?
169
+ true
170
+ end
171
+
172
+ # Custom attribute writer method checking allowed values (enum).
173
+ # @param [Object] type Object to be assigned
174
+ def type=(type)
175
+ validator = EnumAttributeValidator.new('String', ["code_interpreter"])
176
+ unless validator.valid?(type)
177
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
178
+ end
179
+ @type = type
180
+ end
181
+
182
+ # Custom attribute writer method with validation
183
+ # @param [Object] text Value to be assigned
184
+ def text=(text)
185
+ if text.nil?
186
+ fail ArgumentError, 'text cannot be nil'
187
+ end
188
+
189
+ @text = text
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] code Value to be assigned
194
+ def code=(code)
195
+ if code.nil?
196
+ fail ArgumentError, 'code cannot be nil'
197
+ end
198
+
199
+ @code = code
200
+ end
201
+
202
+ # Custom attribute writer method with validation
203
+ # @param [Object] code_issue Value to be assigned
204
+ def code_issue=(code_issue)
205
+ if code_issue.nil?
206
+ fail ArgumentError, 'code_issue cannot be nil'
207
+ end
208
+
209
+ @code_issue = code_issue
210
+ end
211
+
212
+ # Custom attribute writer method with validation
213
+ # @param [Object] code_result Value to be assigned
214
+ def code_result=(code_result)
215
+ if code_result.nil?
216
+ fail ArgumentError, 'code_result cannot be nil'
217
+ end
218
+
219
+ @code_result = code_result
220
+ end
221
+
222
+ # Checks equality by comparing each attribute.
223
+ # @param [Object] Object to be compared
224
+ def ==(o)
225
+ return true if self.equal?(o)
226
+ self.class == o.class &&
227
+ type == o.type &&
228
+ text == o.text &&
229
+ code == o.code &&
230
+ code_issue == o.code_issue &&
231
+ code_result == o.code_result
232
+ end
233
+
234
+ # @see the `==` method
235
+ # @param [Object] Object to be compared
236
+ def eql?(o)
237
+ self == o
238
+ end
239
+
240
+ # Calculates hash code according to all attributes.
241
+ # @return [Integer] Hash code
242
+ def hash
243
+ [type, text, code, code_issue, code_result].hash
244
+ end
245
+
246
+ # Builds the object from hash
247
+ # @param [Hash] attributes Model attributes in the form of hash
248
+ # @return [Object] Returns the model itself
249
+ def self.build_from_hash(attributes)
250
+ return nil unless attributes.is_a?(Hash)
251
+ attributes = attributes.transform_keys(&:to_sym)
252
+ transformed_hash = {}
253
+ openapi_types.each_pair do |key, type|
254
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
255
+ transformed_hash["#{key}"] = nil
256
+ elsif type =~ /\AArray<(.*)>/i
257
+ # check to ensure the input is an array given that the attribute
258
+ # is documented as an array but the input is not
259
+ if attributes[attribute_map[key]].is_a?(Array)
260
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
261
+ end
262
+ elsif !attributes[attribute_map[key]].nil?
263
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
264
+ end
265
+ end
266
+ new(transformed_hash)
267
+ end
268
+
269
+ # Deserializes the data based on type
270
+ # @param string type Data type
271
+ # @param string value Value to be deserialized
272
+ # @return [Object] Deserialized data
273
+ def self._deserialize(type, value)
274
+ case type.to_sym
275
+ when :Time
276
+ Time.parse(value)
277
+ when :Date
278
+ Date.parse(value)
279
+ when :String
280
+ value.to_s
281
+ when :Integer
282
+ value.to_i
283
+ when :Float
284
+ value.to_f
285
+ when :Boolean
286
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
287
+ true
288
+ else
289
+ false
290
+ end
291
+ when :Object
292
+ # generic object (usually a Hash), return directly
293
+ value
294
+ when /\AArray<(?<inner_type>.+)>\z/
295
+ inner_type = Regexp.last_match[:inner_type]
296
+ value.map { |v| _deserialize(inner_type, v) }
297
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
298
+ k_type = Regexp.last_match[:k_type]
299
+ v_type = Regexp.last_match[:v_type]
300
+ {}.tap do |hash|
301
+ value.each do |k, v|
302
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
303
+ end
304
+ end
305
+ else # model
306
+ # models (e.g. Pet) or oneOf
307
+ klass = RagieRubySdk.const_get(type)
308
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
309
+ end
310
+ end
311
+
312
+ # Returns the string representation of the object
313
+ # @return [String] String presentation of the object
314
+ def to_s
315
+ to_hash.to_s
316
+ end
317
+
318
+ # to_body is an alias to to_hash (backward compatibility)
319
+ # @return [Hash] Returns the object in the form of hash
320
+ def to_body
321
+ to_hash
322
+ end
323
+
324
+ # Returns the object in the form of hash
325
+ # @return [Hash] Returns the object in the form of hash
326
+ def to_hash
327
+ hash = {}
328
+ self.class.attribute_map.each_pair do |attr, param|
329
+ value = self.send(attr)
330
+ if value.nil?
331
+ is_nullable = self.class.openapi_nullable.include?(attr)
332
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
333
+ end
334
+
335
+ hash[param] = _to_hash(value)
336
+ end
337
+ hash
338
+ end
339
+
340
+ # Outputs non-array value in the form of hash
341
+ # For object, use to_hash. Otherwise, just return the value
342
+ # @param [Object] value Any valid value
343
+ # @return [Hash] Returns the value in the form of hash
344
+ def _to_hash(value)
345
+ if value.is_a?(Array)
346
+ value.compact.map { |v| _to_hash(v) }
347
+ elsif value.is_a?(Hash)
348
+ {}.tap do |hash|
349
+ value.each { |k, v| hash[k] = _to_hash(v) }
350
+ end
351
+ elsif value.respond_to? :to_hash
352
+ value.to_hash
353
+ else
354
+ value
355
+ end
356
+ end
357
+
358
+ end
359
+
360
+ end