mindee 4.7.0.pre.rc3 → 4.7.0

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -10
  3. data/docs/code_samples/default_v2.txt +14 -2
  4. data/lib/mindee/geometry/polygon.rb +9 -0
  5. data/lib/mindee/geometry/utils.rb +1 -14
  6. data/lib/mindee/http/mindee_api_v2.rb +8 -2
  7. data/lib/mindee/input/inference_parameters.rb +40 -7
  8. data/lib/mindee/parsing/common/ocr/ocr.rb +1 -1
  9. data/lib/mindee/parsing/standard/abstract_field.rb +1 -1
  10. data/lib/mindee/parsing/standard/position_field.rb +1 -1
  11. data/lib/mindee/parsing/v2/field/base_field.rb +8 -5
  12. data/lib/mindee/parsing/v2/field/field_confidence.rb +76 -39
  13. data/lib/mindee/parsing/v2/field/field_location.rb +2 -5
  14. data/lib/mindee/parsing/v2/field/inference_fields.rb +32 -23
  15. data/lib/mindee/parsing/v2/field/list_field.rb +27 -36
  16. data/lib/mindee/parsing/v2/field/object_field.rb +6 -16
  17. data/lib/mindee/parsing/v2/field/simple_field.rb +6 -1
  18. data/lib/mindee/parsing/v2/inference.rb +8 -6
  19. data/lib/mindee/parsing/v2/inference_active_options.rb +42 -0
  20. data/lib/mindee/parsing/v2/inference_model.rb +12 -0
  21. data/lib/mindee/parsing/v2/inference_result.rb +4 -15
  22. data/lib/mindee/parsing/v2/raw_text.rb +7 -7
  23. data/lib/mindee/parsing/v2/raw_text_page.rb +18 -0
  24. data/lib/mindee/parsing/v2.rb +2 -1
  25. data/lib/mindee/version.rb +1 -1
  26. data/sig/mindee/geometry/polygon.rbs +1 -0
  27. data/sig/mindee/input/inference_parameters.rbs +6 -0
  28. data/sig/mindee/parsing/v2/field/field_confidence.rbs +9 -6
  29. data/sig/mindee/parsing/v2/field/field_location.rbs +2 -2
  30. data/sig/mindee/parsing/v2/field/inference_fields.rbs +3 -2
  31. data/sig/mindee/parsing/v2/field/list_field.rbs +3 -1
  32. data/sig/mindee/parsing/v2/field/object_field.rbs +1 -2
  33. data/sig/mindee/parsing/v2/field/simple_field.rbs +1 -1
  34. data/sig/mindee/parsing/v2/inference.rbs +2 -1
  35. data/sig/mindee/parsing/v2/inference_active_options.rbs +14 -0
  36. data/sig/mindee/parsing/v2/inference_result.rbs +2 -1
  37. data/sig/mindee/parsing/v2/raw_text.rbs +2 -2
  38. data/sig/mindee/parsing/v2/{inference_result_options.rbs → raw_text_page.rbs} +3 -3
  39. metadata +8 -6
  40. data/lib/mindee/parsing/v2/inference_result_options.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98d48175f2f2787a85bf193ac18cb41f569b3ffa7fcd609508662380b50b5a49
4
- data.tar.gz: bf3670916d3c4be7c865184d5350c3a397ef0c9d4f3d014b16d837e91ce23ff5
3
+ metadata.gz: 35d4295c966072c96459d8875cad5795c333a4a115dc25670e350db20ec8c4ae
4
+ data.tar.gz: 07e8e9b002996da15e742d6f5607bcd651cec10e3ca1f7218b9e1e0d764e0900
5
5
  SHA512:
6
- metadata.gz: 6bc3903e692541cedb045eefc597d47b6eddea1eb5a146ede8c80766ff6e5f8d59e285ab5a366ea1a673c4092c1670cf5e72504403082ba851416a9670ccc3eb
7
- data.tar.gz: 18cc292275a5dbff543327d6eac8954ee1ebb206f7e361bc2b576cff7948ae6d637fc78c78ff8d1146ba3fbc2d453c5ff99b58538f739c8b153c0fdf78304412
6
+ metadata.gz: c2f326f4e1df9fe406fd625fc557bc5212dcffccb349744e0ba68ae734f9d5ed21cf0cb5381a2a6408aa5fd7f5ff0d462dda42c0295c91a5d514340454404d22
7
+ data.tar.gz: 61807c6f40dbc3955ffb519ee1f5a3698fb4a67048fa9ebec0e284b36e260e2c042b5b9f8cedd7d895587d43501c1d34d8d0909c82681f430a43dc0fed40fa90
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Mindee Ruby API Library Changelog
2
2
 
3
+ ## v4.7.0 - 2025-09-18
4
+ Including RC changes and fixes.
5
+ ### Changes
6
+ * :sparkles: add support for V2 Mindee API
7
+ * :sparkles: add missing accessors for PDF fixing options in `LocalInputSource`
8
+ * :recycle: add many missing internal types
9
+ ### Fixes
10
+ * :recycle: update existing PDF fixing syntax
11
+ * :bug: fix for polygon points not correctly initialized
12
+ * :bug: fix user agent not being able to access version number
13
+ * :bug: fix invalid types for many V1 features
14
+ * :bug: fix V1 errors sometimes having the wrong code
15
+ * :bug: fix many presumably immutable fields having non-readonly parameters
16
+ * :bug: fix broken `resources` accessor in `ApiRequest` object
17
+
18
+
3
19
  ## v4.7.0-rc3 - 2025-08-29
4
20
  ### Fixes
5
21
  * :bug: fix user agent not being able to access version number
@@ -16,7 +32,6 @@
16
32
  ## v4.7.0-rc1 - 2025-08-13
17
33
  ### Changes
18
34
  * :sparkles: add support for client V2 & associated features
19
-
20
35
  ### Fixes
21
36
  * :recycle: add many missing internal types
22
37
  * :bug: fix invalid types for many V1 features
@@ -178,7 +193,6 @@
178
193
  * :sparkles: add support for cropper Extra
179
194
  * :sparkles: add support for full text Extra
180
195
  * :sparkles: add support for invoice splitter auto-extraction
181
-
182
196
  ### Fixes
183
197
  * :bug: fixed a bug that prevented longer decimals from appearing in the string representation of some objects
184
198
  * :bug: fixed a bug that caused non-table elements to unexpectedly appear truncated when printed to the console
@@ -249,7 +263,6 @@
249
263
  * :sparkles: add support for EU Driver License V1
250
264
  * :recycle: update existing products
251
265
  * :arrow_up: upgrade test lib
252
-
253
266
  ### Fixes
254
267
  * :memo: add missing default async sample code
255
268
  * :bug: fix rst display issues
@@ -277,7 +290,6 @@
277
290
  * :sparkles: add support for Carte Grise V1
278
291
  * :sparkles: add page number attributes to doc
279
292
  * :arrow_up: update tests, docs & display format for some products
280
-
281
293
  ### Fixes
282
294
  * :bug: fix page id not working on newer custom models
283
295
 
@@ -293,7 +305,6 @@
293
305
  * :sparkles: add direct access to `raw_http` response
294
306
  * :memo: upgrade reference & guide documentation
295
307
  * :test_tube: **EXPERIMENTAL** add PDF repair option
296
-
297
308
  ### Fixes
298
309
  * :bug: fix display issues with `PositionField`
299
310
 
@@ -308,7 +319,6 @@
308
319
  * :sparkles: add support for US Driver License
309
320
  * :recycle: update unit tests & dependencies
310
321
  * :arrow_up: update Bank Checks (#46)
311
-
312
322
  ### Fixes
313
323
  * :bug: fix `all_words` display (#47)
314
324
  * :bug: fix empty `position_field` (#47)
@@ -323,7 +333,6 @@
323
333
  * :recycle: harmonize naming with other client libraries
324
334
  * :art: moved most parsing modules into their own respective modules
325
335
  * :art: separated common, standard & custom parsing features into their own modules
326
-
327
336
  ### Changes
328
337
  * :sparkles: add support for asynchronous endpoints
329
338
  * :sparkles: add support for Invoice Splitter V1
@@ -337,7 +346,6 @@
337
346
  * :pencil2: document all previously non-documented class
338
347
  * :recycle: match file hierarchy with module nesting
339
348
  * :recycle: rewrite tutorials to match new syntax
340
-
341
349
  ### Fixes
342
350
  * :bug: fix: pages now use the proper `orientation` property
343
351
  * :zap: optimize: only a single endpoint is now created on document upload
@@ -374,8 +382,7 @@
374
382
  * :boom: it should be up to the user to handle API errors
375
383
  * :wastebasket: remove deprecated APIs
376
384
  * :recycle: refactor CLI tool
377
-
378
- ### Additions
385
+ ### Changes
379
386
  * :sparkles: add support for Invoice v4.1 and Receipt v4.1
380
387
  * :sparkles: add EU license plates
381
388
  * :sparkles: add shipping containers support
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mindee'
2
4
 
3
5
  input_path = '/path/to/the/file.ext'
@@ -11,8 +13,18 @@ mindee_client = Mindee::ClientV2.new(api_key: api_key)
11
13
  inference_params = Mindee::Input::InferenceParameters.new(
12
14
  # ID of the model, required.
13
15
  model_id,
14
- # If set to `true`, will enable Retrieval-Augmented Generation.
15
- rag: false,
16
+
17
+ # Options: set to `true` or `false` to override defaults
18
+
19
+ # Enhance extraction accuracy with Retrieval-Augmented Generation.
20
+ rag: nil,
21
+ # Extract the full text content from the document as strings.
22
+ raw_text: nil,
23
+ # Calculate bounding box polygons for all fields.
24
+ polygon: nil,
25
+ # Boost the precision and accuracy of all extractions.
26
+ # Calculate confidence scores for all fields.
27
+ confidence: nil
16
28
  )
17
29
 
18
30
  # Load a file from disk
@@ -5,6 +5,15 @@ module Mindee
5
5
  module Geometry
6
6
  # Contains any number of vertex coordinates (Points).
7
7
  class Polygon < Array
8
+ # @param server_response [Hash] Raw server response hash.
9
+ def initialize(server_response)
10
+ points = []
11
+ server_response.map do |point|
12
+ points << Point.new(point[0], point[1])
13
+ end
14
+ super(points)
15
+ end
16
+
8
17
  # Get the central point (centroid) of the polygon.
9
18
  # @return [Mindee::Geometry::Point]
10
19
  def centroid
@@ -17,19 +17,6 @@ module Mindee
17
17
  )
18
18
  end
19
19
 
20
- # Transform a prediction into a Polygon.
21
- # @param prediction [Hash]
22
- # @return [Mindee::Geometry::Polygon]
23
- def self.polygon_from_prediction(prediction)
24
- polygon = Polygon.new
25
- return polygon if prediction.nil?
26
-
27
- prediction.each do |point|
28
- polygon << Point.new(point[0], point[1])
29
- end
30
- polygon
31
- end
32
-
33
20
  # Gets the points of a bounding box for a given set of points
34
21
  # @param vertices [Array<Mindee::Geometry::Point>]
35
22
  # @return [Array<Float>]
@@ -39,7 +26,7 @@ module Mindee
39
26
  [x_coords.min, y_coords.min, x_coords.max, y_coords.max]
40
27
  end
41
28
 
42
- # Creates the bounding bounding box for a given set of points
29
+ # Creates the bounding box for a given set of points
43
30
  # @param vertices [Array<Mindee::Geometry::Point>]
44
31
  # @return [Mindee::Geometry::Quadrilateral]
45
32
  def self.get_bounding_box(vertices)
@@ -123,8 +123,14 @@ module Mindee
123
123
  file_data, file_metadata = input_source.read_contents(close: params.close_file)
124
124
  [['file', file_data, file_metadata]] # : Array[untyped]
125
125
  end
126
- form_data.push ['model_id', params.model_id]
127
- form_data.push ['rag', 'true'] if params.rag
126
+ form_data.push(['model_id', params.model_id])
127
+
128
+ # deal with optional features
129
+ form_data.push(['rag', params.rag.to_s]) unless params.rag.nil?
130
+ form_data.push(['raw_text', params.raw_text.to_s]) unless params.raw_text.nil?
131
+ form_data.push(['polygon', params.polygon.to_s]) unless params.polygon.nil?
132
+ form_data.push(['confidence', params.confidence.to_s]) unless params.confidence.nil?
133
+
128
134
  form_data.push ['file_alias', params.file_alias] if params.file_alias
129
135
  unless params.webhook_ids.nil? || params.webhook_ids.empty?
130
136
  form_data.push ['webhook_ids', params.webhook_ids.join(',')]
@@ -7,9 +7,21 @@ module Mindee
7
7
  # @return [String] ID of the model (required).
8
8
  attr_reader :model_id
9
9
 
10
- # @return [Boolean, nil] Enable Retrieval-Augmented Generation.
10
+ # @return [Boolean, nil] Enhance extraction accuracy with Retrieval-Augmented Generation.
11
11
  attr_reader :rag
12
12
 
13
+ # @return [Boolean, nil] Extract the full text content from the document as strings,
14
+ # and fill the raw_text` attribute.
15
+ attr_reader :raw_text
16
+
17
+ # @return [Boolean, nil] Calculate bounding box polygons for all fields,
18
+ # and fill their `locations` attribute.
19
+ attr_reader :polygon
20
+
21
+ # @return [Boolean, nil] Boost the precision and accuracy of all extractions.
22
+ # Calculate confidence scores for all fields, and fill their confidence attribute.
23
+ attr_reader :confidence
24
+
13
25
  # @return [String, nil] Optional alias for the file.
14
26
  attr_reader :file_alias
15
27
 
@@ -22,21 +34,39 @@ module Mindee
22
34
  # @return [Boolean, nil] Whether to close the file after parsing.
23
35
  attr_reader :close_file
24
36
 
37
+ # rubocop:disable Metrics/ParameterLists
25
38
  # @param [String] model_id ID of the model
26
- # @param [FalseClass] rag Whether to enable rag.
39
+ # @param [nil] rag Whether to enable RAG.
40
+ # @param [nil] raw_text Whether to enable rax text.
41
+ # @param [nil] polygon Whether to enable polygons.
42
+ # @param [nil] confidence Whether to enable confidence scores.
27
43
  # @param [nil] file_alias File alias, if applicable.
28
44
  # @param [nil] webhook_ids
29
45
  # @param [nil] polling_options
30
46
  # @param [TrueClass] close_file
31
- def initialize(model_id, rag: false, file_alias: nil, webhook_ids: nil, polling_options: nil, close_file: true)
47
+ def initialize(
48
+ model_id,
49
+ rag: nil,
50
+ raw_text: nil,
51
+ polygon: nil,
52
+ confidence: nil,
53
+ file_alias: nil,
54
+ webhook_ids: nil,
55
+ polling_options: nil,
56
+ close_file: true
57
+ )
32
58
  raise Errors::MindeeInputError, 'Model ID is required.' if model_id.empty? || model_id.nil?
33
59
 
34
60
  @model_id = model_id
35
- @rag = rag || false
61
+ @rag = rag
62
+ @raw_text = raw_text
63
+ @polygon = polygon
64
+ @confidence = confidence
36
65
  @file_alias = file_alias
37
66
  @webhook_ids = webhook_ids || []
38
67
  @polling_options = get_clean_polling_options(polling_options)
39
68
  @close_file = close_file.nil? || close_file
69
+ # rubocop:enable Metrics/ParameterLists
40
70
  end
41
71
 
42
72
  # Validates the parameters for async auto-polling
@@ -70,7 +100,10 @@ module Mindee
70
100
  end
71
101
 
72
102
  model_id = params.fetch(:model_id)
73
- rag = params.fetch(:rag, false)
103
+ rag = params.fetch(:rag, nil)
104
+ raw_text = params.fetch(:raw_text, nil)
105
+ polygon = params.fetch(:polygon, nil)
106
+ confidence = params.fetch(:confidence, nil)
74
107
  file_alias = params.fetch(:file_alias, nil)
75
108
  webhook_ids = params.fetch(:webhook_ids, [])
76
109
  polling_options_input = params.fetch(:page_options, PollingOptions.new)
@@ -83,8 +116,8 @@ module Mindee
83
116
  )
84
117
  end
85
118
  close_file = params.fetch(:close_file, true)
86
- InferenceParameters.new(model_id, rag: rag, file_alias: file_alias, webhook_ids: webhook_ids,
87
- close_file: close_file)
119
+ InferenceParameters.new(model_id, rag: rag, raw_text: raw_text, polygon: polygon, confidence: confidence,
120
+ file_alias: file_alias, webhook_ids: webhook_ids, close_file: close_file)
88
121
  end
89
122
 
90
123
  private
@@ -23,7 +23,7 @@ module Mindee
23
23
  def initialize(prediction)
24
24
  @text = prediction['text']
25
25
  @confidence = prediction['confidence']
26
- @polygon = Geometry.polygon_from_prediction(prediction['polygon'])
26
+ @polygon = Mindee::Geometry::Polygon.new(prediction['polygon'])
27
27
  @bounding_box = Geometry.get_bounding_box(@polygon) unless @polygon.nil? || @polygon.empty?
28
28
  end
29
29
 
@@ -21,7 +21,7 @@ module Mindee
21
21
  # @param page_id [Integer, nil]
22
22
  def initialize(prediction, page_id)
23
23
  @confidence = prediction['confidence'] if prediction.key?('confidence')
24
- @polygon = Geometry.polygon_from_prediction(prediction['polygon']) if prediction.key?('polygon')
24
+ @polygon = Mindee::Geometry::Polygon.new(prediction['polygon']) if prediction.key?('polygon')
25
25
  @bounding_box = Geometry.get_bounding_box(@polygon) unless @polygon.nil? || @polygon.empty?
26
26
  @page_id = page_id || prediction['page_id']
27
27
  end
@@ -20,7 +20,7 @@ module Mindee
20
20
  # @param page_id [Integer, nil]
21
21
  def initialize(prediction, page_id)
22
22
  unless prediction['polygon'].nil? || prediction['polygon'].empty?
23
- @polygon = Geometry.polygon_from_prediction(prediction['polygon'])
23
+ @polygon = Mindee::Geometry::Polygon.new(prediction['polygon'])
24
24
  end
25
25
  @quadrangle = to_quadrilateral(prediction, 'quadrangle')
26
26
  @rectangle = to_quadrilateral(prediction, 'rectangle')
@@ -20,13 +20,16 @@ module Mindee
20
20
  # @param indent_level [Integer] Level of indentation for rst display.
21
21
  def initialize(raw_prediction, indent_level = 0)
22
22
  @indent_level = indent_level
23
- @confidence = raw_prediction.key?('confidence') ? raw_prediction['confidence'] : nil
24
- @locations = if raw_prediction.key?('locations')
25
- raw_prediction['locations'].map do |location|
23
+ confidence = raw_prediction['confidence']
24
+ @confidence = FieldConfidence.new(confidence) unless confidence.nil? || confidence.empty?
25
+
26
+ locations = raw_prediction['locations']
27
+ @locations = if locations.nil? || locations.empty?
28
+ []
29
+ else
30
+ locations.map do |location|
26
31
  FieldLocation.new(location)
27
32
  end
28
- else
29
- []
30
33
  end
31
34
  end
32
35
 
@@ -19,70 +19,107 @@ module Mindee
19
19
  LOW = 'Low'
20
20
 
21
21
  # List of valid values, as frozen strings.
22
- VALID_VALUES = [CERTAIN, HIGH, MEDIUM, LOW].freeze
22
+ VALID_VALUES = ['Certain', 'High', 'Medium', 'Low'].freeze
23
23
 
24
24
  # @param value [String] The confidence level value.
25
25
  # @raise [ArgumentError] If the value is not a valid confidence level.
26
26
  def initialize(value)
27
- unless VALID_VALUES.include?(value)
27
+ case value
28
+ when 'Certain' then @value = CERTAIN
29
+ when 'High' then @value = HIGH
30
+ when 'Medium' then @value = MEDIUM
31
+ when 'Low' then @value = LOW
32
+ else
28
33
  raise ArgumentError,
29
- "Invalid confidence level: #{value}. Must be one of: #{VALID_VALUES.join(', ')}"
34
+ "Invalid confidence level: '#{value}'. Must be one of: #{VALID_VALUES.join(', ')}"
30
35
  end
31
36
 
32
37
  @value = value
33
38
  end
34
39
 
35
- # Create a FieldConfidence from a string value.
36
- # @param value [String] The confidence level string.
37
- # @return [FieldConfidence] The confidence instance.
38
- def self.from_string(value)
39
- new(value)
40
+ # String representation of the confidence level.
41
+ # @return [String] The confidence level value.
42
+ def to_s
43
+ @value
40
44
  end
41
45
 
42
- # Check if this is a certain confidence level.
43
- # @return [Boolean] `true` if confidence is certain.
44
- def certain?
45
- @value == CERTAIN
46
+ # String representation of the confidence level.
47
+ # @return [Integer] The confidence level value as an integer: 1 is LOW, 4 is HIGH.
48
+ def to_i
49
+ val_to_i(@value)
46
50
  end
47
51
 
48
- # Check if this is a high confidence level.
49
- # @return [Boolean] `true` if confidence is high.
50
- def high?
51
- @value == HIGH
52
+ # Inspect method for debugging.
53
+ # @return [String] Debug representation.
54
+ def inspect
55
+ "#<#{self.class.name}:#{@value}>"
52
56
  end
53
57
 
54
- # Check if this is a medium confidence level.
55
- # @return [Boolean] `true` if confidence is medium.
56
- def medium?
57
- @value == MEDIUM
58
- end
58
+ # Using 'case' breaks steep ...
59
+ # rubocop:disable Style/CaseLikeIf
59
60
 
60
- # Check if this is a low confidence level.
61
- # @return [Boolean] `true` if confidence is low.
62
- def low?
63
- @value == LOW
61
+ # Equality of two FieldConfidence instances.
62
+ # @param other [String, Integer, FieldConfidence] The other confidence to compare.
63
+ # @return [Boolean] `true` if they have the same value.
64
+ def ==(other)
65
+ if other.is_a?(FieldConfidence)
66
+ @value == other.value
67
+ elsif other.is_a?(String)
68
+ @value == other
69
+ elsif other.is_a?(Integer)
70
+ to_i == other
71
+ else
72
+ raise ArgumentError, "Invalid type: #{other.class}"
73
+ end
64
74
  end
65
75
 
66
- # String representation of the confidence level.
67
- # @return [String] The confidence level value.
68
- def to_s
69
- @value
76
+ # Greater than or equality of two FieldConfidence instances.
77
+ # @param other [String, Integer, FieldConfidence] The other confidence to compare.
78
+ def >=(other)
79
+ if other.is_a?(FieldConfidence)
80
+ to_i >= val_to_i(other.value)
81
+ elsif other.is_a?(String)
82
+ to_i >= val_to_i(other)
83
+ elsif other.is_a?(Integer)
84
+ to_i >= other
85
+ else
86
+ raise ArgumentError, "Invalid type: #{other.class}"
87
+ end
70
88
  end
71
89
 
72
- # Compare two FieldConfidence instances.
73
- # @param other [FieldConfidence] The other confidence to compare.
74
- # @return [Boolean] `true` if they have the same value.
75
- def ==(other)
76
- other.is_a?(FieldConfidence) && @value == other.value
90
+ # less than or equality of two FieldConfidence instances.
91
+ # # @param other [String, Integer, FieldConfidence] The other confidence to compare.
92
+ def <=(other)
93
+ if other.is_a?(FieldConfidence)
94
+ to_i <= val_to_i(other.value)
95
+ elsif other.is_a?(String)
96
+ to_i <= val_to_i(other)
97
+ elsif other.is_a?(Integer)
98
+ to_i <= other
99
+ else
100
+ raise ArgumentError, "Invalid type: #{other.class}"
101
+ end
77
102
  end
78
103
 
79
- # Make instances comparable and hashable
104
+ # rubocop:enable Style/CaseLikeIf
105
+
106
+ # Aliases for the comparison operators.
80
107
  alias eql? ==
108
+ alias gteql? >=
109
+ alias lteql? <=
81
110
 
82
- # Inspect method for debugging.
83
- # @return [String] Debug representation.
84
- def inspect
85
- "#<#{self.class.name}:#{@value}>"
111
+ protected
112
+
113
+ def val_to_i(value)
114
+ case value
115
+ when CERTAIN then 4
116
+ when HIGH then 3
117
+ when MEDIUM then 2
118
+ when LOW then 1
119
+ else
120
+ raise ArgumentError,
121
+ "Invalid confidence level: '#{value}'. Must be one of: #{VALID_VALUES.join(', ')}"
122
+ end
86
123
  end
87
124
  end
88
125
  end
@@ -16,11 +16,8 @@ module Mindee
16
16
 
17
17
  # @param server_response [Hash] Raw server response hash.
18
18
  def initialize(server_response)
19
- polygon_data = server_response['polygon'] || server_response[:polygon]
20
- @polygon = polygon_data ? Mindee::Geometry::Polygon.new(polygon_data) : nil
21
-
22
- page_id = server_response['page'] || server_response[:page]
23
- @page = page_id.is_a?(Float) || page_id.is_a?(Integer) ? page_id.to_i : nil
19
+ @polygon = Mindee::Geometry::Polygon.new(server_response['polygon'])
20
+ @page = server_response['page']
24
21
  end
25
22
 
26
23
  # String representation of the polygon (empty string when none).
@@ -6,7 +6,8 @@ module Mindee
6
6
  module Parsing
7
7
  module V2
8
8
  module Field
9
- # Collection of inference fields that extends Hash functionality.
9
+ # Represents a hash-like collection of inference fields, providing methods for
10
+ # retrieval and string representation.
10
11
  class InferenceFields < Hash
11
12
  # @return [Integer] Level of indentation for rst display.
12
13
  attr_reader :indent_level
@@ -29,23 +30,37 @@ module Mindee
29
30
  self[key]
30
31
  end
31
32
 
32
- # Allow dot notation access to fields.
33
- # @param method_name [Symbol] The method name (field key).
34
- # @return [BaseField, nil] The field or nil if not found.
35
- def method_missing(method_name, *args, &block)
36
- key = method_name.to_s
37
- if key?(key)
38
- self[key]
39
- else
40
- super
41
- end
33
+ # Get a field by key and ensure it is a SimpleField.
34
+ # @param key [String] Field key to retrieve.
35
+ # @return [SimpleField] The SimpleField.
36
+ # @raise [TypeError] If the field is not a SimpleField.
37
+ def get_simple_field(key)
38
+ field = self[key]
39
+ raise TypeError, "Field #{key} is not a SimpleField" unless field.is_a?(SimpleField)
40
+
41
+ field
42
42
  end
43
43
 
44
- # Check if method_missing should handle the method.
45
- # @param method_name [Symbol] The method name.
46
- # @return [Boolean] `true` if the method should be handled.
47
- def respond_to_missing?(method_name, include_private = false)
48
- key?(method_name.to_s) || super
44
+ # Get a field by key and ensure it is a ListField.
45
+ # @param key [String] Field key to retrieve.
46
+ # @return [ListField] The ListField.
47
+ # @raise [TypeError] If the field is not a ListField.
48
+ def get_list_field(key)
49
+ field = self[key]
50
+ raise TypeError, "Field #{key} is not a ListField" unless field.is_a?(ListField)
51
+
52
+ field
53
+ end
54
+
55
+ # Get a field by key and ensure it is an ObjectField.
56
+ # @param key [String] Field key to retrieve.
57
+ # @return [ObjectField] The ObjectField.
58
+ # @raise [TypeError] If the field is not an ObjectField.
59
+ def get_object_field(key)
60
+ field = self[key]
61
+ raise TypeError, "Field #{key} is not a ObjectField" unless field.is_a?(ObjectField)
62
+
63
+ field
49
64
  end
50
65
 
51
66
  # rubocop:disable Metrics/CyclomaticComplexity
@@ -64,13 +79,7 @@ module Mindee
64
79
  line = "#{padding}:#{field_key}:"
65
80
 
66
81
  case (field_value.class.name || '').split('::').last
67
- when 'ListField'
68
- # Check if ListField has items and they're not empty
69
- list_f = field_value # @type var list_f: ListField
70
- if defined?(list_f.items) && list_f.items && !list_f.items.empty?
71
- line += list_f.to_s
72
- end
73
- when 'ObjectField'
82
+ when 'ListField', 'ObjectField'
74
83
  line += field_value.to_s
75
84
  when 'SimpleField'
76
85
  # Check if SimpleField has a non-empty value
@@ -8,7 +8,6 @@ module Mindee
8
8
  module Field
9
9
  # Represents a field that contains a list of items.
10
10
  class ListField < BaseField
11
- include Enumerable
12
11
  # @return [Array<ListField | ObjectField | SimpleField>] Items contained in the list.
13
12
  attr_reader :items
14
13
 
@@ -29,10 +28,36 @@ module Mindee
29
28
  end
30
29
  end
31
30
 
31
+ # Return only simple fields.
32
+ # @return [Array<SimpleField>] Simple fields contained in the list.
33
+ # @raise [TypeError] If the fields are not SimpleField.
34
+ def simple_items
35
+ fields = []
36
+ @items.each do |item|
37
+ raise TypeError, "Invalid field type detected: #{item.class}" unless item.is_a?(SimpleField)
38
+
39
+ fields << item
40
+ end
41
+ fields
42
+ end
43
+
44
+ # Return only object fields.
45
+ # @return [Array<ObjectField>] Object fields contained in the list.
46
+ # @raise [TypeError] If the fields are not ObjectField.
47
+ def object_items
48
+ fields = []
49
+ @items.each do |item|
50
+ raise TypeError, "Invalid field type detected: #{item.class}" unless item.is_a?(ObjectField)
51
+
52
+ fields << item
53
+ end
54
+ fields
55
+ end
56
+
32
57
  # String representation of the list field.
33
58
  # @return [String] Formatted string with bullet points for each item.
34
59
  def to_s
35
- return "\n" if @items.empty?
60
+ return '' unless @items && !@items.empty?
36
61
 
37
62
  parts = ['']
38
63
  @items.each do |item|
@@ -47,40 +72,6 @@ module Mindee
47
72
 
48
73
  parts.join("\n * ")
49
74
  end
50
-
51
- # Check if the list is empty.
52
- # @return [Boolean] `true` if the list has no items.
53
- def empty?
54
- @items.empty?
55
- end
56
-
57
- # Get the number of items in the list.
58
- # @return [Integer] Number of items.
59
- def size
60
- @items.size
61
- end
62
-
63
- # Get the number of items in the list (alias for size).
64
- # @return [Integer] Number of items.
65
- def length
66
- @items.length
67
- end
68
-
69
- # Get an item by index.
70
- # @param index [Integer] The index of the item to retrieve.
71
- # @return [BaseField, nil] The item at the given index.
72
- def [](index)
73
- @items[index]
74
- end
75
-
76
- # Iterator for Enumerator inheritance.
77
- # NOTE: Untyped due to incomplete support in current supported version of RBS.
78
- def each(&block)
79
- return to_enum(:each) unless block_given?
80
-
81
- @items.each(&block)
82
- self
83
- end
84
75
  end
85
76
  end
86
77
  end
@@ -78,22 +78,12 @@ module Mindee
78
78
  out_str
79
79
  end
80
80
 
81
- # Allow dot notation access to nested fields.
82
- # @param method_name [Symbol] The method name (field key).
83
- # @return [ObjectField, nil] The field or nil if not found.
84
- def method_missing(method_name, ...)
85
- if @fields.respond_to?(method_name)
86
- @fields.send(method_name, ...)
87
- else
88
- super
89
- end
90
- end
91
-
92
- # Check if method_missing should handle the method.
93
- # @param method_name [Symbol] The method name.
94
- # @return [Boolean] `true` if the method should be handled.
95
- def respond_to_missing?(method_name, include_private = false)
96
- @fields.respond_to?(method_name) || super
81
+ # Get a field by key and ensure it is a SimpleField.
82
+ # @param key [String] Field key to retrieve.
83
+ # @return [SimpleField] The SimpleField.
84
+ # @raise [TypeError] If the field is not a SimpleField.
85
+ def get_simple_field(key)
86
+ @fields.get_simple_field(key)
97
87
  end
98
88
  end
99
89
  end
@@ -15,7 +15,12 @@ module Mindee
15
15
  # @param indent_level [Integer] Level of indentation for rst display.
16
16
  def initialize(server_response, indent_level = 0)
17
17
  super
18
- @value = server_response.key?('value') ? server_response['value'] : nil
18
+ value = server_response['value']
19
+ @value = if value.is_a?(Integer)
20
+ value.to_f
21
+ else
22
+ value
23
+ end
19
24
  end
20
25
 
21
26
  # String representation of the field value.
@@ -3,20 +3,23 @@
3
3
  require_relative 'inference_model'
4
4
  require_relative 'inference_file'
5
5
  require_relative 'inference_result'
6
+ require_relative 'inference_active_options'
6
7
 
7
8
  module Mindee
8
9
  module Parsing
9
10
  module V2
10
11
  # Complete data returned by an inference request.
11
12
  class Inference
13
+ # @return [String] Identifier of the inference (when provided by API).
14
+ attr_reader :id
12
15
  # @return [InferenceModel] Information about the model used.
13
16
  attr_reader :model
14
17
  # @return [InferenceFile] Information about the processed file.
15
18
  attr_reader :file
19
+ # @return [InferenceActiveOptions] Options which were activated during the inference.
20
+ attr_reader :active_options
16
21
  # @return [InferenceResult] Result contents.
17
22
  attr_reader :result
18
- # @return [String] Identifier of the inference (when provided by API).
19
- attr_reader :id
20
23
 
21
24
  # @param server_response [Hash] Hash representation of the JSON returned by the service.
22
25
  def initialize(server_response)
@@ -24,6 +27,7 @@ module Mindee
24
27
 
25
28
  @model = InferenceModel.new(server_response['model'])
26
29
  @file = InferenceFile.new(server_response['file'])
30
+ @active_options = InferenceActiveOptions.new(server_response['active_options'])
27
31
  @result = InferenceResult.new(server_response['result'])
28
32
 
29
33
  @id = server_response['id']
@@ -35,11 +39,9 @@ module Mindee
35
39
  [
36
40
  'Inference',
37
41
  '#########',
38
- 'Model',
39
- '=====',
40
- ":ID: #{@model.id}",
41
- '',
42
+ @model.to_s,
42
43
  @file.to_s,
44
+ @active_options.to_s,
43
45
  @result.to_s,
44
46
  '',
45
47
  ].join("\n")
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mindee
4
+ module Parsing
5
+ module V2
6
+ # Options which were activated during the inference.
7
+ class InferenceActiveOptions
8
+ # @return [Boolean] Whether the Raw Text feature was activated.
9
+ attr_reader :raw_text
10
+ # @return [Boolean] Whether the polygon feature was activated.
11
+ attr_reader :polygon
12
+ # @return [Boolean] Whether the confidence feature was activated.
13
+ attr_reader :confidence
14
+ # @return [Boolean] Whether the Retrieval-Augmented Generation feature was activated.
15
+ attr_reader :rag
16
+
17
+ # @param server_response [Hash] Raw JSON parsed into a Hash.
18
+ def initialize(server_response)
19
+ @raw_text = server_response['raw_text']
20
+ @polygon = server_response['polygon']
21
+ @confidence = server_response['confidence']
22
+ @rag = server_response['rag']
23
+ end
24
+
25
+ # String representation.
26
+ # @return [String]
27
+ def to_s
28
+ parts = [
29
+ 'Active Options',
30
+ '==============',
31
+ ":Raw Text: #{@raw_text ? 'True' : 'False'}",
32
+ ":Polygon: #{@polygon ? 'True' : 'False'}",
33
+ ":Confidence: #{@confidence ? 'True' : 'False'}",
34
+ ":RAG: #{@rag ? 'True' : 'False'}",
35
+ '',
36
+ ]
37
+ parts.join("\n")
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -12,6 +12,18 @@ module Mindee
12
12
  def initialize(server_response)
13
13
  @id = server_response['id']
14
14
  end
15
+
16
+ # String representation.
17
+ # @return [String]
18
+ def to_s
19
+ parts = [
20
+ 'Model',
21
+ '=====',
22
+ ":ID: #{@id}",
23
+ '',
24
+ ]
25
+ parts.join("\n")
26
+ end
15
27
  end
16
28
  end
17
29
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'field/inference_fields'
4
- require_relative 'inference_result_options'
4
+ require_relative 'raw_text'
5
5
 
6
6
  module Mindee
7
7
  module Parsing
@@ -10,8 +10,8 @@ module Mindee
10
10
  class InferenceResult
11
11
  # @return [Mindee::Parsing::V2::Field::InferenceFields] Fields produced by the model.
12
12
  attr_reader :fields
13
- # @return [Mindee::Parsing::V2::InferenceResultOptions, nil] Optional extra data.
14
- attr_reader :options
13
+ # @return [Mindee::Parsing::V2::RawText, nil] Optional extra data.
14
+ attr_reader :raw_text
15
15
 
16
16
  # @param server_response [Hash] Hash version of the JSON returned by the API.
17
17
  def initialize(server_response)
@@ -19,9 +19,7 @@ module Mindee
19
19
 
20
20
  @fields = Field::InferenceFields.new(server_response['fields'])
21
21
 
22
- return unless server_response.key?('options') && server_response['options']
23
-
24
- @options = InferenceResultOptions.new(server_response['options'])
22
+ @raw_text = server_response['raw_text'] ? RawText.new(server_response['raw_text']) : nil
25
23
  end
26
24
 
27
25
  # String representation.
@@ -32,15 +30,6 @@ module Mindee
32
30
  '======',
33
31
  @fields.to_s,
34
32
  ]
35
-
36
- if @options
37
- parts += [
38
- 'Options',
39
- '=======',
40
- @options.to_s,
41
- ]
42
- end
43
-
44
33
  parts.join("\n")
45
34
  end
46
35
  end
@@ -3,17 +3,17 @@
3
3
  module Mindee
4
4
  module Parsing
5
5
  module V2
6
- # Raw text extracted from a given page.
6
+ # Raw text extracted from all pages in the document.
7
7
  class RawText
8
- # @return [Integer] Page number where the text was found.
9
- attr_reader :page
10
- # @return [String] Text content.
11
- attr_reader :content
8
+ # @return [Array[Mindee::Parsing::V2::RawTextPage]] List of pages with their extracted text content.
9
+ attr_reader :pages
12
10
 
13
11
  # @param server_response [Hash] Raw JSON parsed into a Hash.
14
12
  def initialize(server_response)
15
- @page = server_response['page']
16
- @content = server_response['content']
13
+ @pages = []
14
+ server_response.fetch('pages', []).each do |page|
15
+ @pages.push RawTextPage.new(page)
16
+ end
17
17
  end
18
18
  end
19
19
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mindee
4
+ module Parsing
5
+ module V2
6
+ # Raw text extracted from a single page.
7
+ class RawTextPage
8
+ # @return [Boolean] Text content of the page as a single string. '\n' is used to separate lines.
9
+ attr_reader :content
10
+
11
+ # @param server_response [Hash] Raw JSON parsed into a Hash.
12
+ def initialize(server_response)
13
+ @content = server_response['content']
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -8,8 +8,9 @@ require_relative 'v2/inference_file'
8
8
  require_relative 'v2/inference_model'
9
9
  require_relative 'v2/inference_response'
10
10
  require_relative 'v2/inference_result'
11
- require_relative 'v2/inference_result_options'
11
+ require_relative 'v2/inference_active_options'
12
12
  require_relative 'v2/job'
13
13
  require_relative 'v2/job_response'
14
14
  require_relative 'v2/job_webhook'
15
15
  require_relative 'v2/raw_text'
16
+ require_relative 'v2/raw_text_page'
@@ -3,7 +3,7 @@
3
3
  # Mindee
4
4
  module Mindee
5
5
  # Current version.
6
- VERSION = '4.7.0-rc3'
6
+ VERSION = '4.7.0'
7
7
 
8
8
  # Finds and return the current platform.
9
9
  # @return [Symbol, Hash[String | Symbol, Regexp], Nil?]
@@ -2,6 +2,7 @@
2
2
  module Mindee
3
3
  module Geometry
4
4
  class Polygon < Array[Point]
5
+ def initialize: (Array[::Mindee::Geometry::Point | Array[Float]]) -> void
5
6
  def centroid: -> Point
6
7
  def point_in_y?: (Point) -> bool
7
8
  end
@@ -3,15 +3,21 @@ module Mindee
3
3
  module Input
4
4
  class InferenceParameters
5
5
  attr_reader close_file: bool
6
+ attr_reader confidence: bool?
6
7
  attr_reader file_alias: String?
7
8
  attr_reader model_id: String
8
9
  attr_reader polling_options: PollingOptions
10
+ attr_reader polygon: bool?
9
11
  attr_reader rag: bool?
12
+ attr_reader raw_text: bool?
10
13
  attr_reader webhook_ids: Array[String]?
11
14
 
12
15
  def initialize: (
13
16
  String,
14
17
  ?rag: bool?,
18
+ ?raw_text: bool?,
19
+ ?polygon: bool?,
20
+ ?confidence: bool?,
15
21
  ?file_alias: String?,
16
22
  ?webhook_ids: Array[String]?,
17
23
  ?polling_options: Hash[Symbol | String, untyped] | PollingOptions?,
@@ -12,14 +12,17 @@ module Mindee
12
12
  VALID_VALUES: Array[String]
13
13
  def initialize: (String) -> void
14
14
  def self.from_string: (String) -> FieldConfidence
15
- def certain?: -> bool
16
- def high?: -> bool
17
- def medium?: -> bool
18
- def low?: -> bool
15
+ def to_i: -> Integer
19
16
  def to_s: -> String
20
- def ==: (FieldConfidence) -> bool
21
- def eql?: (FieldConfidence) -> bool
17
+ def ==: (String | Integer | FieldConfidence) -> bool
18
+ def eql?: (String | Integer | FieldConfidence) -> bool
19
+ def <=: (String | Integer | FieldConfidence) -> bool
20
+ def lteql? : (String | Integer | FieldConfidence) -> bool
21
+ def >=: (String | Integer | FieldConfidence) -> bool
22
+ def gteql?: (String | Integer | FieldConfidence) -> bool
22
23
  def inspect: -> String
24
+
25
+ def val_to_i: (String) -> Integer
23
26
  end
24
27
  end
25
28
  end
@@ -4,8 +4,8 @@ module Mindee
4
4
  module V2
5
5
  module Field
6
6
  class FieldLocation
7
- attr_reader page: Integer?
8
- attr_reader polygon: Geometry::Polygon?
7
+ attr_reader page: Integer
8
+ attr_reader polygon: Geometry::Polygon
9
9
 
10
10
  def initialize: (Hash[String | Symbol, untyped]) -> void
11
11
  def to_s: -> String
@@ -6,11 +6,12 @@ module Mindee
6
6
  class InferenceFields < Hash[String, ListField | ObjectField | SimpleField?]
7
7
  attr_reader indent_level: Integer
8
8
 
9
+ def get_list_field: (String) -> ListField
10
+ def get_simple_field: (String) -> SimpleField
11
+ def get_object_field: (String) -> ObjectField
9
12
  def logger: () -> Logger
10
13
  def initialize: (Hash[String | Symbol, untyped], ?Integer) -> void
11
14
  def get: (String) -> (ListField | ObjectField | SimpleField?)
12
- def method_missing: (Symbol, *untyped) -> (ListField | ObjectField | SimpleField?)
13
- def respond_to_missing?: (Symbol, ?bool) -> bool
14
15
  def to_s: (?Integer) -> String
15
16
  end
16
17
  end
@@ -6,8 +6,10 @@ module Mindee
6
6
  class ListField < BaseField
7
7
  include Enumerable[BaseField]
8
8
 
9
- attr_reader items: Array[BaseField]
9
+ attr_reader items: Array[SimpleField | ObjectField | ListField]
10
10
  def initialize: (Hash[String | Symbol, untyped], ?Integer) -> void
11
+ def object_items: -> Array[ObjectField]
12
+ def simple_items: -> Array[SimpleField]
11
13
  def to_s: -> String
12
14
  def empty?: -> bool
13
15
  def size: -> Integer
@@ -8,12 +8,11 @@ module Mindee
8
8
  class ObjectField < BaseField
9
9
  attr_reader fields: InferenceFields
10
10
  def initialize: (Hash[String | Symbol, untyped], ?Integer) -> void
11
+ def get_simple_field: (String) -> SimpleField
11
12
  def multi_str: -> String
12
- def respond_to_missing?: (Symbol, bool) -> bool
13
13
  def single_str: -> String
14
14
  def to_s: -> String
15
15
  def to_s_from_list: -> String
16
- def method_missing: (Symbol, *untyped, untyped) -> (ObjectField?)
17
16
  end
18
17
  end
19
18
  end
@@ -4,7 +4,7 @@ module Mindee
4
4
  module V2
5
5
  module Field
6
6
  class SimpleField < BaseField
7
- attr_reader value: String | Integer | Float | bool?
7
+ attr_reader value: String | Integer | Float | bool | nil
8
8
 
9
9
  def initialize: (Hash[String | Symbol, untyped], ?Integer) -> void
10
10
  def to_s: -> String
@@ -3,9 +3,10 @@ module Mindee
3
3
  module Parsing
4
4
  module V2
5
5
  class Inference
6
- attr_reader file: InferenceFile
7
6
  attr_reader id: String
8
7
  attr_reader model: InferenceModel
8
+ attr_reader file: InferenceFile
9
+ attr_reader active_options: InferenceActiveOptions
9
10
  attr_reader result: InferenceResult
10
11
 
11
12
  def initialize: (Hash[String | Symbol, untyped]) -> void
@@ -0,0 +1,14 @@
1
+ module Mindee
2
+ module Parsing
3
+ module V2
4
+ class InferenceActiveOptions
5
+ attr_reader confidence: bool
6
+ attr_reader polygon: bool
7
+ attr_reader rag: bool
8
+ attr_reader raw_text: bool
9
+
10
+ def initialize: (Hash[String | Symbol, untyped]) -> void
11
+ end
12
+ end
13
+ end
14
+ end
@@ -4,7 +4,8 @@ module Mindee
4
4
  module V2
5
5
  class InferenceResult
6
6
  attr_reader fields: Field::InferenceFields
7
- attr_reader options: InferenceResultOptions?
7
+ attr_reader raw_text: RawText?
8
+
8
9
  def initialize: (Hash[String | Symbol, untyped]) -> void
9
10
  def to_s: -> String
10
11
  end
@@ -3,8 +3,8 @@ module Mindee
3
3
  module Parsing
4
4
  module V2
5
5
  class RawText
6
- attr_reader page: Integer?
7
- attr_reader content: String?
6
+ attr_reader pages: Array[RawTextPage]
7
+
8
8
  def initialize: (Hash[String | Symbol, untyped]) -> void
9
9
  end
10
10
  end
@@ -1,9 +1,9 @@
1
- # lib/mindee/parsing/v2/inference_result_options.rb
2
1
  module Mindee
3
2
  module Parsing
4
3
  module V2
5
- class InferenceResultOptions
6
- attr_reader raw_texts: Array[RawText]
4
+ class RawTextPage
5
+ attr_reader content: string
6
+
7
7
  def initialize: (Hash[String | Symbol, untyped]) -> void
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mindee
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.0.pre.rc3
4
+ version: 4.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mindee, SA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-29 00:00:00.000000000 Z
11
+ date: 2025-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -377,15 +377,16 @@ files:
377
377
  - lib/mindee/parsing/v2/field/object_field.rb
378
378
  - lib/mindee/parsing/v2/field/simple_field.rb
379
379
  - lib/mindee/parsing/v2/inference.rb
380
+ - lib/mindee/parsing/v2/inference_active_options.rb
380
381
  - lib/mindee/parsing/v2/inference_file.rb
381
382
  - lib/mindee/parsing/v2/inference_model.rb
382
383
  - lib/mindee/parsing/v2/inference_response.rb
383
384
  - lib/mindee/parsing/v2/inference_result.rb
384
- - lib/mindee/parsing/v2/inference_result_options.rb
385
385
  - lib/mindee/parsing/v2/job.rb
386
386
  - lib/mindee/parsing/v2/job_response.rb
387
387
  - lib/mindee/parsing/v2/job_webhook.rb
388
388
  - lib/mindee/parsing/v2/raw_text.rb
389
+ - lib/mindee/parsing/v2/raw_text_page.rb
389
390
  - lib/mindee/pdf.rb
390
391
  - lib/mindee/pdf/extracted_pdf.rb
391
392
  - lib/mindee/pdf/pdf_compressor.rb
@@ -650,15 +651,16 @@ files:
650
651
  - sig/mindee/parsing/v2/field/object_field.rbs
651
652
  - sig/mindee/parsing/v2/field/simple_field.rbs
652
653
  - sig/mindee/parsing/v2/inference.rbs
654
+ - sig/mindee/parsing/v2/inference_active_options.rbs
653
655
  - sig/mindee/parsing/v2/inference_file.rbs
654
656
  - sig/mindee/parsing/v2/inference_model.rbs
655
657
  - sig/mindee/parsing/v2/inference_response.rbs
656
658
  - sig/mindee/parsing/v2/inference_result.rbs
657
- - sig/mindee/parsing/v2/inference_result_options.rbs
658
659
  - sig/mindee/parsing/v2/job.rbs
659
660
  - sig/mindee/parsing/v2/job_response.rbs
660
661
  - sig/mindee/parsing/v2/job_webhook.rbs
661
662
  - sig/mindee/parsing/v2/raw_text.rbs
663
+ - sig/mindee/parsing/v2/raw_text_page.rbs
662
664
  - sig/mindee/pdf/extracted_pdf.rbs
663
665
  - sig/mindee/pdf/pdf_compressor.rbs
664
666
  - sig/mindee/pdf/pdf_extractor.rbs
@@ -858,9 +860,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
858
860
  version: '3.0'
859
861
  required_rubygems_version: !ruby/object:Gem::Requirement
860
862
  requirements:
861
- - - ">"
863
+ - - ">="
862
864
  - !ruby/object:Gem::Version
863
- version: 1.3.1
865
+ version: '0'
864
866
  requirements: []
865
867
  rubygems_version: 3.2.33
866
868
  signing_key:
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'raw_text'
4
-
5
- module Mindee
6
- module Parsing
7
- module V2
8
- # Optional data returned alongside an inference.
9
- class InferenceResultOptions
10
- # @return [Array<RawText>] Collection of raw texts per page.
11
- attr_reader :raw_texts
12
-
13
- # @param server_response [Hash] Raw JSON parsed into a Hash.
14
- def initialize(server_response)
15
- raw = server_response['raw_texts']
16
- @raw_texts = raw.is_a?(Array) ? raw.map { |rt| RawText.new(rt) } : []
17
- end
18
- end
19
- end
20
- end
21
- end