ragie_ruby_sdk 1.0.16 → 1.0.18

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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -5
  3. data/docs/CodeInterpreterOutput.md +28 -0
  4. data/docs/CodeInterpreterOutputLogs.md +20 -0
  5. data/docs/FileSearchOutput.md +26 -0
  6. data/docs/FileSearchResult.md +26 -0
  7. data/docs/FinalAnswerStepsInner.md +4 -0
  8. data/docs/QueryDetails.md +24 -0
  9. data/docs/Reasoning.md +1 -1
  10. data/docs/ReasoningOutput.md +28 -0
  11. data/docs/ReasoningSummary.md +20 -0
  12. data/docs/ReasoningText.md +20 -0
  13. data/docs/Response.md +4 -4
  14. data/docs/ResponseOutputInner.md +40 -0
  15. data/docs/{ResponseOutput.md → ResponseOutputMessage.md} +2 -2
  16. data/docs/SearchEffort.md +15 -0
  17. data/docs/SearchStep.md +1 -1
  18. data/docs/SearchStepWithQueryDetails.md +28 -0
  19. data/lib/ragie_ruby_sdk/models/code_interpreter_output.rb +389 -0
  20. data/lib/ragie_ruby_sdk/models/code_interpreter_output_logs.rb +283 -0
  21. data/lib/ragie_ruby_sdk/models/file_search_output.rb +368 -0
  22. data/lib/ragie_ruby_sdk/models/file_search_result.rb +348 -0
  23. data/lib/ragie_ruby_sdk/models/final_answer_steps_inner.rb +1 -0
  24. data/lib/ragie_ruby_sdk/models/query_details.rb +341 -0
  25. data/lib/ragie_ruby_sdk/models/reasoning.rb +1 -2
  26. data/lib/ragie_ruby_sdk/models/reasoning_output.rb +391 -0
  27. data/lib/ragie_ruby_sdk/models/reasoning_summary.rb +283 -0
  28. data/lib/ragie_ruby_sdk/models/reasoning_text.rb +283 -0
  29. data/lib/ragie_ruby_sdk/models/response.rb +4 -7
  30. data/lib/ragie_ruby_sdk/models/response_output_inner.rb +105 -0
  31. data/lib/ragie_ruby_sdk/models/{response_output.rb → response_output_message.rb} +3 -3
  32. data/lib/ragie_ruby_sdk/models/search_effort.rb +41 -0
  33. data/lib/ragie_ruby_sdk/models/search_step.rb +3 -3
  34. data/lib/ragie_ruby_sdk/models/search_step_with_query_details.rb +358 -0
  35. data/lib/ragie_ruby_sdk/version.rb +1 -1
  36. data/lib/ragie_ruby_sdk.rb +12 -1
  37. data/spec/models/code_interpreter_output_logs_spec.rb +46 -0
  38. data/spec/models/code_interpreter_output_spec.rb +74 -0
  39. data/spec/models/file_search_output_spec.rb +68 -0
  40. data/spec/models/file_search_result_spec.rb +60 -0
  41. data/spec/models/query_details_spec.rb +54 -0
  42. data/spec/models/reasoning_output_spec.rb +74 -0
  43. data/spec/models/reasoning_summary_spec.rb +46 -0
  44. data/spec/models/reasoning_text_spec.rb +46 -0
  45. data/spec/models/response_output_inner_spec.rb +21 -0
  46. data/spec/models/{response_output_spec.rb → response_output_message_spec.rb} +6 -6
  47. data/spec/models/search_effort_spec.rb +30 -0
  48. data/spec/models/search_step_spec.rb +1 -1
  49. data/spec/models/search_step_with_query_details_spec.rb +70 -0
  50. metadata +49 -5
@@ -0,0 +1,283 @@
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.17.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module RagieRubySdk
17
+ class ReasoningText
18
+ # The text of the reasoning.
19
+ attr_accessor :text
20
+
21
+ attr_accessor :type
22
+
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'text' => :'text',
49
+ :'type' => :'type'
50
+ }
51
+ end
52
+
53
+ # Returns attribute mapping this model knows about
54
+ def self.acceptable_attribute_map
55
+ attribute_map
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ acceptable_attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'text' => :'String',
67
+ :'type' => :'String'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RagieRubySdk::ReasoningText` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ acceptable_attribute_map = self.class.acceptable_attribute_map
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!acceptable_attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RagieRubySdk::ReasoningText`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'text')
94
+ self.text = attributes[:'text']
95
+ else
96
+ self.text = nil
97
+ end
98
+
99
+ if attributes.key?(:'type')
100
+ self.type = attributes[:'type']
101
+ else
102
+ self.type = 'reasoning_text'
103
+ end
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properties with the reasons
108
+ def list_invalid_properties
109
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
110
+ invalid_properties = Array.new
111
+ if @text.nil?
112
+ invalid_properties.push('invalid value for "text", text cannot be nil.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ warn '[DEPRECATED] the `valid?` method is obsolete'
122
+ return false if @text.nil?
123
+ type_validator = EnumAttributeValidator.new('String', ["reasoning_text"])
124
+ return false unless type_validator.valid?(@type)
125
+ true
126
+ end
127
+
128
+ # Custom attribute writer method with validation
129
+ # @param [Object] text Value to be assigned
130
+ def text=(text)
131
+ if text.nil?
132
+ fail ArgumentError, 'text cannot be nil'
133
+ end
134
+
135
+ @text = text
136
+ end
137
+
138
+ # Custom attribute writer method checking allowed values (enum).
139
+ # @param [Object] type Object to be assigned
140
+ def type=(type)
141
+ validator = EnumAttributeValidator.new('String', ["reasoning_text"])
142
+ unless validator.valid?(type)
143
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
144
+ end
145
+ @type = type
146
+ end
147
+
148
+ # Checks equality by comparing each attribute.
149
+ # @param [Object] Object to be compared
150
+ def ==(o)
151
+ return true if self.equal?(o)
152
+ self.class == o.class &&
153
+ text == o.text &&
154
+ type == o.type
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Integer] Hash code
165
+ def hash
166
+ [text, type].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def self.build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ attributes = attributes.transform_keys(&:to_sym)
175
+ transformed_hash = {}
176
+ openapi_types.each_pair do |key, type|
177
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
178
+ transformed_hash["#{key}"] = nil
179
+ elsif type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[attribute_map[key]].is_a?(Array)
183
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
184
+ end
185
+ elsif !attributes[attribute_map[key]].nil?
186
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
187
+ end
188
+ end
189
+ new(transformed_hash)
190
+ end
191
+
192
+ # Deserializes the data based on type
193
+ # @param string type Data type
194
+ # @param string value Value to be deserialized
195
+ # @return [Object] Deserialized data
196
+ def self._deserialize(type, value)
197
+ case type.to_sym
198
+ when :Time
199
+ Time.parse(value)
200
+ when :Date
201
+ Date.parse(value)
202
+ when :String
203
+ value.to_s
204
+ when :Integer
205
+ value.to_i
206
+ when :Float
207
+ value.to_f
208
+ when :Boolean
209
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
210
+ true
211
+ else
212
+ false
213
+ end
214
+ when :Object
215
+ # generic object (usually a Hash), return directly
216
+ value
217
+ when /\AArray<(?<inner_type>.+)>\z/
218
+ inner_type = Regexp.last_match[:inner_type]
219
+ value.map { |v| _deserialize(inner_type, v) }
220
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
221
+ k_type = Regexp.last_match[:k_type]
222
+ v_type = Regexp.last_match[:v_type]
223
+ {}.tap do |hash|
224
+ value.each do |k, v|
225
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
226
+ end
227
+ end
228
+ else # model
229
+ # models (e.g. Pet) or oneOf
230
+ klass = RagieRubySdk.const_get(type)
231
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
232
+ end
233
+ end
234
+
235
+ # Returns the string representation of the object
236
+ # @return [String] String presentation of the object
237
+ def to_s
238
+ to_hash.to_s
239
+ end
240
+
241
+ # to_body is an alias to to_hash (backward compatibility)
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_body
244
+ to_hash
245
+ end
246
+
247
+ # Returns the object in the form of hash
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_hash
250
+ hash = {}
251
+ self.class.attribute_map.each_pair do |attr, param|
252
+ value = self.send(attr)
253
+ if value.nil?
254
+ is_nullable = self.class.openapi_nullable.include?(attr)
255
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
256
+ end
257
+
258
+ hash[param] = _to_hash(value)
259
+ end
260
+ hash
261
+ end
262
+
263
+ # Outputs non-array value in the form of hash
264
+ # For object, use to_hash. Otherwise, just return the value
265
+ # @param [Object] value Any valid value
266
+ # @return [Hash] Returns the value in the form of hash
267
+ def _to_hash(value)
268
+ if value.is_a?(Array)
269
+ value.compact.map { |v| _to_hash(v) }
270
+ elsif value.is_a?(Hash)
271
+ {}.tap do |hash|
272
+ value.each { |k, v| hash[k] = _to_hash(v) }
273
+ end
274
+ elsif value.respond_to? :to_hash
275
+ value.to_hash
276
+ else
277
+ value
278
+ end
279
+ end
280
+
281
+ end
282
+
283
+ end
@@ -130,11 +130,11 @@ module RagieRubySdk
130
130
  :'created_at' => :'Integer',
131
131
  :'status' => :'String',
132
132
  :'error' => :'String',
133
- :'incomplete_details' => :'Object',
133
+ :'incomplete_details' => :'Null',
134
134
  :'instructions' => :'String',
135
- :'max_output_tokens' => :'Object',
135
+ :'max_output_tokens' => :'Null',
136
136
  :'model' => :'String',
137
- :'output' => :'Array<ResponseOutput>',
137
+ :'output' => :'Array<ResponseOutputInner>',
138
138
  :'output_parsed' => :'FinalAnswer',
139
139
  :'tools' => :'Array<Tool>',
140
140
  :'reasoning' => :'Reasoning',
@@ -146,7 +146,7 @@ module RagieRubySdk
146
146
  :'top_p' => :'Float',
147
147
  :'truncation' => :'String',
148
148
  :'usage' => :'RagieApiSchemaResponseUsage',
149
- :'user' => :'Object',
149
+ :'user' => :'Null',
150
150
  :'metadata' => :'Hash<String, Object>'
151
151
  }
152
152
  end
@@ -155,12 +155,9 @@ module RagieRubySdk
155
155
  def self.openapi_nullable
156
156
  Set.new([
157
157
  :'error',
158
- :'incomplete_details',
159
158
  :'instructions',
160
- :'max_output_tokens',
161
159
  :'output_parsed',
162
160
  :'previous_response_id',
163
- :'user',
164
161
  ])
165
162
  end
166
163
 
@@ -0,0 +1,105 @@
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.17.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module RagieRubySdk
17
+ module ResponseOutputInner
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'CodeInterpreterOutput',
23
+ :'FileSearchOutput',
24
+ :'ReasoningOutput',
25
+ :'ResponseOutputMessage'
26
+ ]
27
+ end
28
+
29
+ # Builds the object
30
+ # @param [Mixed] Data to be matched against the list of anyOf items
31
+ # @return [Object] Returns the model or the data itself
32
+ def build(data)
33
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
34
+ # Note:
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_any_of.each do |klass|
40
+ begin
41
+ next if klass == :AnyType # "nullable: true"
42
+ return find_and_cast_into_type(klass, data)
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_any_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.iso8601(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = RagieRubySdk.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module RagieRubySdk
17
- class ResponseOutput
17
+ class ResponseOutputMessage
18
18
  attr_accessor :type
19
19
 
20
20
  attr_accessor :id
@@ -85,14 +85,14 @@ module RagieRubySdk
85
85
  # @param [Hash] attributes Model attributes in the form of hash
86
86
  def initialize(attributes = {})
87
87
  if (!attributes.is_a?(Hash))
88
- fail ArgumentError, "The input argument (attributes) must be a hash in `RagieRubySdk::ResponseOutput` initialize method"
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RagieRubySdk::ResponseOutputMessage` initialize method"
89
89
  end
90
90
 
91
91
  # check to see if the attribute exists and convert string to symbol for hash key
92
92
  acceptable_attribute_map = self.class.acceptable_attribute_map
93
93
  attributes = attributes.each_with_object({}) { |(k, v), h|
94
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
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RagieRubySdk::ResponseOutputMessage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
96
96
  end
97
97
  h[k.to_sym] = v
98
98
  }
@@ -0,0 +1,41 @@
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.17.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module RagieRubySdk
17
+ class SearchEffort
18
+ LOW = "low".freeze
19
+ MEDIUM = "medium".freeze
20
+ HIGH = "high".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [LOW, MEDIUM, HIGH].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if SearchEffort.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #SearchEffort"
39
+ end
40
+ end
41
+ end
@@ -101,7 +101,7 @@ module RagieRubySdk
101
101
  if attributes.key?(:'type')
102
102
  self.type = attributes[:'type']
103
103
  else
104
- self.type = 'search'
104
+ self.type = 'base_search'
105
105
  end
106
106
 
107
107
  if attributes.key?(:'think')
@@ -147,7 +147,7 @@ module RagieRubySdk
147
147
  # @return true if the model is valid
148
148
  def valid?
149
149
  warn '[DEPRECATED] the `valid?` method is obsolete'
150
- type_validator = EnumAttributeValidator.new('String', ["search"])
150
+ type_validator = EnumAttributeValidator.new('String', ["base_search"])
151
151
  return false unless type_validator.valid?(@type)
152
152
  return false if @think.nil?
153
153
  return false if @current_question.nil?
@@ -158,7 +158,7 @@ module RagieRubySdk
158
158
  # Custom attribute writer method checking allowed values (enum).
159
159
  # @param [Object] type Object to be assigned
160
160
  def type=(type)
161
- validator = EnumAttributeValidator.new('String', ["search"])
161
+ validator = EnumAttributeValidator.new('String', ["base_search"])
162
162
  unless validator.valid?(type)
163
163
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
164
164
  end