ragie_ruby_sdk 1.0.12 → 1.0.14

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