mindee 4.3.0 → 4.4.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +9 -0
- data/docs/code_samples/workflow_execution.txt +1 -1
- data/docs/code_samples/workflow_polling.txt +36 -0
- data/lib/mindee/client.rb +13 -13
- data/lib/mindee/http/endpoint.rb +37 -47
- data/lib/mindee/http/response_validation.rb +1 -1
- data/lib/mindee/parsing/common/api_response.rb +1 -1
- data/lib/mindee/parsing/common/document.rb +1 -1
- data/lib/mindee/parsing/common/extras/extras.rb +4 -1
- data/lib/mindee/parsing/common/extras/rag_extra.rb +24 -0
- data/lib/mindee/parsing/common/extras.rb +1 -0
- data/lib/mindee/parsing/common/inference.rb +3 -0
- data/lib/mindee/parsing/standard/tax_field.rb +9 -9
- data/lib/mindee/pdf/pdf_extractor.rb +1 -1
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_items.rb +2 -2
- data/lib/mindee/product/financial_document/financial_document_v1_line_items.rb +2 -2
- data/lib/mindee/product/fr/bank_statement/bank_statement_v2_transactions.rb +2 -2
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_usages.rb +2 -2
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_subscriptions.rb +2 -2
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contributions.rb +2 -2
- data/lib/mindee/product/fr/payslip/payslip_v2_salary_details.rb +2 -2
- data/lib/mindee/product/fr/payslip/payslip_v3_paid_time_offs.rb +2 -2
- data/lib/mindee/product/fr/payslip/payslip_v3_salary_details.rb +2 -2
- data/lib/mindee/product/invoice/invoice_v4_line_items.rb +2 -2
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_invoice_page_groups.rb +2 -2
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrients.rb +2 -2
- data/lib/mindee/product/receipt/receipt_v5_line_items.rb +2 -2
- data/lib/mindee/product/resume/resume_v1_certificates.rb +2 -2
- data/lib/mindee/product/resume/resume_v1_educations.rb +2 -2
- data/lib/mindee/product/resume/resume_v1_languages.rb +2 -2
- data/lib/mindee/product/resume/resume_v1_professional_experiences.rb +2 -2
- data/lib/mindee/product/resume/resume_v1_social_networks_urls.rb +2 -2
- data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_copays.rb +2 -2
- data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_addresses.rb +2 -2
- data/lib/mindee/product/us/us_mail/us_mail_v3_recipient_addresses.rb +2 -2
- data/lib/mindee/version.rb +1 -1
- data/mindee.gemspec +1 -1
- data/sig/custom/net_http.rbs +3 -0
- data/sig/mindee/client.rbs +4 -2
- data/sig/mindee/http/endpoint.rbs +9 -8
- data/sig/mindee/http/response_validation.rbs +3 -3
- data/sig/mindee/parsing/common/api_response.rbs +1 -1
- data/sig/mindee/parsing/common/extras/full_text_ocr_extra.rbs +2 -2
- data/sig/mindee/parsing/common/extras/rag_extra.rbs +15 -0
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9a2e1c98c3971454ebfaefe6902121bfab6e577f693e36a525739eb2dfbeeb9
|
4
|
+
data.tar.gz: 7f35351f0f647a165c82f512395e8883647e96165968869bf3904f4c2bf6b4ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '072284cd8bb18b6190b870aa014fb278744a6db35d1210ca57dbddb1d78c71a2675f2675a7ce581b83cbb1fdcd88cdeb6dedd6892c2402b43cf3f711425f9e46'
|
7
|
+
data.tar.gz: 4bad8302b9bef1496fc47e5f04cb301dd3c81a99dff5800ffbc1aaf3ef4bf1f5a6493f4908178b337e7f25596b7f9ce2946d47d7526b38065ccfbd7ac045624a
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Mindee Ruby API Library Changelog
|
2
2
|
|
3
|
+
## v4.4.0 - 2025-04-23
|
4
|
+
### Changes
|
5
|
+
* :sparkles: add support for workflow polling
|
6
|
+
* :sparkles: add extras accessor from inference
|
7
|
+
### Fixes
|
8
|
+
* :recycle: fix misc typing issues
|
9
|
+
* :bug: fix improper return format for `raw_http`
|
10
|
+
|
11
|
+
|
3
12
|
## v4.3.0 - 2025-04-08
|
4
13
|
### Changes
|
5
14
|
* :sparkles: add support for Financial Document V1.12
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#
|
2
|
+
# Install the Ruby client library by running:
|
3
|
+
# gem install mindee
|
4
|
+
#
|
5
|
+
|
6
|
+
require 'mindee'
|
7
|
+
|
8
|
+
workflow_id = 'workflow-id'
|
9
|
+
|
10
|
+
# Init a new client
|
11
|
+
mindee_client = Mindee::Client.new
|
12
|
+
|
13
|
+
# Load a file from disk
|
14
|
+
input_source = mindee_client.source_from_path('path/to/my/file.ext')
|
15
|
+
|
16
|
+
# Initialize a custom endpoint for this product
|
17
|
+
custom_endpoint = mindee_client.create_endpoint(
|
18
|
+
account_name: 'my-account',
|
19
|
+
endpoint_name: 'my-endpoint',
|
20
|
+
version: 'my-version'
|
21
|
+
)
|
22
|
+
|
23
|
+
# Parse the file
|
24
|
+
result = mindee_client.parse(
|
25
|
+
input_source,
|
26
|
+
Mindee::Product::Universal::Universal,
|
27
|
+
endpoint: custom_endpoint,
|
28
|
+
options: {
|
29
|
+
rag: true,
|
30
|
+
workflow_id: workflow_id
|
31
|
+
}
|
32
|
+
)
|
33
|
+
|
34
|
+
# Print a full summary of the parsed data in RST format
|
35
|
+
puts result.document
|
36
|
+
|
data/lib/mindee/client.rb
CHANGED
@@ -54,8 +54,8 @@ module Mindee
|
|
54
54
|
# @!attribute delay_sec [Numeric] Delay between polling attempts. Defaults to 1.5.
|
55
55
|
# @!attribute max_retries [Integer] Maximum number of retries. Defaults to 80.
|
56
56
|
class ParseOptions
|
57
|
-
attr_accessor :all_words, :full_text, :close_file, :page_options, :cropper,
|
58
|
-
:initial_delay_sec, :delay_sec, :max_retries
|
57
|
+
attr_accessor :all_words, :full_text, :close_file, :page_options, :cropper, :rag,
|
58
|
+
:workflow_id, :initial_delay_sec, :delay_sec, :max_retries
|
59
59
|
|
60
60
|
def initialize(params: {})
|
61
61
|
params = params.transform_keys(&:to_sym)
|
@@ -66,6 +66,8 @@ module Mindee
|
|
66
66
|
raw_page_options = PageOptions.new(params: raw_page_options) unless raw_page_options.is_a?(PageOptions)
|
67
67
|
@page_options = raw_page_options
|
68
68
|
@cropper = params.fetch(:cropper, false)
|
69
|
+
@rag = params.fetch(:rag, false)
|
70
|
+
@workflow_id = params.fetch(:workflow_id, nil)
|
69
71
|
@initial_delay_sec = params.fetch(:initial_delay_sec, 2)
|
70
72
|
@delay_sec = params.fetch(:delay_sec, 1.5)
|
71
73
|
@max_retries = params.fetch(:max_retries, 80)
|
@@ -176,13 +178,10 @@ module Mindee
|
|
176
178
|
|
177
179
|
prediction, raw_http = endpoint.predict(
|
178
180
|
input_source,
|
179
|
-
options
|
180
|
-
options.full_text,
|
181
|
-
options.close_file,
|
182
|
-
options.cropper
|
181
|
+
options
|
183
182
|
)
|
184
183
|
|
185
|
-
Mindee::Parsing::Common::ApiResponse.new(product_class, prediction, raw_http)
|
184
|
+
Mindee::Parsing::Common::ApiResponse.new(product_class, prediction, raw_http.to_s)
|
186
185
|
end
|
187
186
|
|
188
187
|
# Enqueue a document for async parsing
|
@@ -207,6 +206,8 @@ module Mindee
|
|
207
206
|
# - `:on_min_pages` [Integer] Apply the operation only if the document has at least this many pages.
|
208
207
|
# * `:cropper` [bool] Whether to include cropper results for each page.
|
209
208
|
# This performs a cropping operation on the server and will increase response time.
|
209
|
+
# * `:rag` [bool] Whether to enable Retrieval-Augmented Generation. Only works if a Workflow ID is provided.
|
210
|
+
# * `:workflow_id` [String, nil] ID of the workflow to use.
|
210
211
|
# @param endpoint [Mindee::HTTP::Endpoint] Endpoint of the API.
|
211
212
|
# @return [Mindee::Parsing::Common::ApiResponse]
|
212
213
|
def enqueue(input_source, product_class, endpoint: nil, options: {})
|
@@ -216,12 +217,9 @@ module Mindee
|
|
216
217
|
|
217
218
|
prediction, raw_http = endpoint.predict_async(
|
218
219
|
input_source,
|
219
|
-
opts
|
220
|
-
opts.full_text,
|
221
|
-
opts.close_file,
|
222
|
-
opts.cropper
|
220
|
+
opts
|
223
221
|
)
|
224
|
-
Mindee::Parsing::Common::ApiResponse.new(product_class, prediction, raw_http)
|
222
|
+
Mindee::Parsing::Common::ApiResponse.new(product_class, prediction, raw_http.to_json)
|
225
223
|
end
|
226
224
|
|
227
225
|
# Parses a queued document
|
@@ -236,7 +234,7 @@ module Mindee
|
|
236
234
|
endpoint = initialize_endpoint(product_class) if endpoint.nil?
|
237
235
|
logger.debug("Fetching queued document as '#{endpoint.url_root}'")
|
238
236
|
prediction, raw_http = endpoint.parse_async(job_id)
|
239
|
-
Mindee::Parsing::Common::ApiResponse.new(product_class, prediction, raw_http)
|
237
|
+
Mindee::Parsing::Common::ApiResponse.new(product_class, prediction, raw_http.to_json)
|
240
238
|
end
|
241
239
|
|
242
240
|
# Enqueue a document for async parsing and automatically try to retrieve it
|
@@ -261,6 +259,8 @@ module Mindee
|
|
261
259
|
# - `:on_min_pages` [Integer] Apply the operation only if the document has at least this many pages.
|
262
260
|
# * `:cropper` [bool, nil] Whether to include cropper results for each page.
|
263
261
|
# This performs a cropping operation on the server and will increase response time.
|
262
|
+
# * `:rag` [bool] Whether to enable Retrieval-Augmented Generation. Only works if a Workflow ID is provided.
|
263
|
+
# * `:workflow_id` [String, nil] ID of the workflow to use.
|
264
264
|
# * `:initial_delay_sec` [Numeric] Initial delay before polling. Defaults to 2.
|
265
265
|
# * `:delay_sec` [Numeric] Delay between polling attempts. Defaults to 1.5.
|
266
266
|
# * `:max_retries` [Integer] Maximum number of retries. Defaults to 80.
|
data/lib/mindee/http/endpoint.rb
CHANGED
@@ -34,6 +34,8 @@ module Mindee
|
|
34
34
|
attr_reader :request_timeout
|
35
35
|
# @return [String]
|
36
36
|
attr_reader :url_root
|
37
|
+
# @return [String]
|
38
|
+
attr_reader :base_url
|
37
39
|
|
38
40
|
def initialize(owner, url_name, version, api_key: '')
|
39
41
|
@owner = owner
|
@@ -44,25 +46,19 @@ module Mindee
|
|
44
46
|
logger.debug('API key set from environment')
|
45
47
|
end
|
46
48
|
@api_key = api_key.nil? || api_key.empty? ? ENV.fetch(API_KEY_ENV_NAME, API_KEY_DEFAULT) : api_key
|
47
|
-
base_url = ENV.fetch(BASE_URL_ENV_NAME, BASE_URL_DEFAULT)
|
48
|
-
@url_root = "#{base_url
|
49
|
+
@base_url = ENV.fetch(BASE_URL_ENV_NAME, BASE_URL_DEFAULT).chomp('/')
|
50
|
+
@url_root = "#{@base_url}/products/#{@owner}/#{@url_name}/v#{@version}"
|
49
51
|
end
|
50
52
|
|
51
53
|
# Call the prediction API.
|
52
54
|
# @param input_source [Mindee::Input::Source::LocalInputSource, Mindee::Input::Source::URLInputSource]
|
53
|
-
# @param
|
54
|
-
# @param full_text [bool] Whether to include the full OCR text response in compatible APIs
|
55
|
-
# @param close_file [bool] Whether the file will be closed after reading
|
56
|
-
# @param cropper [bool] Whether a cropping operation will be applied
|
55
|
+
# @param opts [ParseOptions] Parse options.
|
57
56
|
# @return [Array]
|
58
|
-
def predict(input_source,
|
57
|
+
def predict(input_source, opts)
|
59
58
|
check_api_key
|
60
59
|
response = predict_req_post(
|
61
60
|
input_source,
|
62
|
-
|
63
|
-
full_text: full_text,
|
64
|
-
close_file: close_file,
|
65
|
-
cropper: cropper
|
61
|
+
opts
|
66
62
|
)
|
67
63
|
if !response.nil? && response.respond_to?(:body)
|
68
64
|
hashed_response = JSON.parse(response.body, object_class: Hash)
|
@@ -76,14 +72,11 @@ module Mindee
|
|
76
72
|
|
77
73
|
# Call the prediction API.
|
78
74
|
# @param input_source [Mindee::Input::Source::LocalInputSource, Mindee::Input::Source::URLInputSource]
|
79
|
-
# @param
|
80
|
-
# @param full_text [bool] Whether to include the full OCR text response in compatible APIs.
|
81
|
-
# @param close_file [bool] Whether the file will be closed after reading
|
82
|
-
# @param cropper [bool] Whether a cropping operation will be applied
|
75
|
+
# @param opts [ParseOptions, Hash] Parse options.
|
83
76
|
# @return [Array]
|
84
|
-
def predict_async(input_source,
|
77
|
+
def predict_async(input_source, opts)
|
85
78
|
check_api_key
|
86
|
-
response =
|
79
|
+
response = document_queue_req_post(input_source, opts)
|
87
80
|
if !response.nil? && response.respond_to?(:body)
|
88
81
|
hashed_response = JSON.parse(response.body, object_class: Hash)
|
89
82
|
return [hashed_response, response.body] if ResponseValidation.valid_async_response?(response)
|
@@ -100,7 +93,7 @@ module Mindee
|
|
100
93
|
# @return [Array]
|
101
94
|
def parse_async(job_id)
|
102
95
|
check_api_key
|
103
|
-
response =
|
96
|
+
response = document_queue_req_get(job_id)
|
104
97
|
hashed_response = JSON.parse(response.body, object_class: Hash)
|
105
98
|
return [hashed_response, response.body] if ResponseValidation.valid_async_response?(response)
|
106
99
|
|
@@ -112,17 +105,14 @@ module Mindee
|
|
112
105
|
private
|
113
106
|
|
114
107
|
# @param input_source [Mindee::Input::Source::LocalInputSource, Mindee::Input::Source::URLInputSource]
|
115
|
-
# @param
|
116
|
-
# @param full_text [bool] Whether to include the full OCR text response in compatible APIs.
|
117
|
-
# @param close_file [bool] Whether the file will be closed after reading
|
118
|
-
# @param cropper [bool] Whether a cropping operation will be applied
|
108
|
+
# @param opts [ParseOptions] Parse options.
|
119
109
|
# @return [Net::HTTPResponse, nil]
|
120
|
-
def predict_req_post(input_source,
|
110
|
+
def predict_req_post(input_source, opts)
|
121
111
|
uri = URI("#{@url_root}/predict")
|
122
112
|
|
123
113
|
params = {} # : Hash[Symbol | String, untyped]
|
124
|
-
params[:cropper] = 'true' if cropper
|
125
|
-
params[:full_text_ocr] = 'true' if full_text
|
114
|
+
params[:cropper] = 'true' if opts.cropper
|
115
|
+
params[:full_text_ocr] = 'true' if opts.full_text
|
126
116
|
uri.query = URI.encode_www_form(params)
|
127
117
|
|
128
118
|
headers = {
|
@@ -131,32 +121,33 @@ module Mindee
|
|
131
121
|
}
|
132
122
|
req = Net::HTTP::Post.new(uri, headers)
|
133
123
|
form_data = if input_source.is_a?(Mindee::Input::Source::URLInputSource)
|
134
|
-
[['document', input_source.url]]
|
124
|
+
[['document', input_source.url]] # : Array[untyped]
|
135
125
|
else
|
136
|
-
[input_source.read_contents(close: close_file)]
|
126
|
+
[input_source.read_contents(close: opts.close_file)] # : Array[untyped]
|
137
127
|
end
|
138
|
-
form_data.push ['include_mvision', 'true'] if all_words
|
128
|
+
form_data.push ['include_mvision', 'true'] if opts.all_words
|
139
129
|
|
140
130
|
req.set_form(form_data, 'multipart/form-data')
|
141
|
-
response = nil
|
142
131
|
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: @request_timeout) do |http|
|
143
|
-
|
132
|
+
return http.request(req)
|
144
133
|
end
|
145
|
-
response
|
134
|
+
raise Mindee::Errors::MindeeError, 'Could not resolve server response.'
|
146
135
|
end
|
147
136
|
|
148
137
|
# @param input_source [Mindee::Input::Source::LocalInputSource, Mindee::Input::Source::URLInputSource]
|
149
|
-
# @param
|
150
|
-
# @
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
138
|
+
# @param opts [ParseOptions] Parse options.
|
139
|
+
# @return [Net::HTTPResponse]
|
140
|
+
def document_queue_req_post(input_source, opts)
|
141
|
+
uri = if opts.workflow_id
|
142
|
+
URI("#{@base_url}/workflows/#{opts.workflow_id}/predict_async")
|
143
|
+
else
|
144
|
+
URI("#{@url_root}/predict_async")
|
145
|
+
end
|
156
146
|
|
157
147
|
params = {} # : Hash[Symbol | String, untyped]
|
158
|
-
params[:cropper] = 'true' if cropper
|
159
|
-
params[:full_text_ocr] = 'true' if full_text
|
148
|
+
params[:cropper] = 'true' if opts.cropper
|
149
|
+
params[:full_text_ocr] = 'true' if opts.full_text
|
150
|
+
params[:rag] = 'true' if opts.rag
|
160
151
|
uri.query = URI.encode_www_form(params)
|
161
152
|
|
162
153
|
headers = {
|
@@ -165,24 +156,23 @@ module Mindee
|
|
165
156
|
}
|
166
157
|
req = Net::HTTP::Post.new(uri, headers)
|
167
158
|
form_data = if input_source.is_a?(Mindee::Input::Source::URLInputSource)
|
168
|
-
[['document', input_source.url]]
|
159
|
+
[['document', input_source.url]] # : Array[untyped]
|
169
160
|
else
|
170
|
-
[input_source.read_contents(close: close_file)]
|
161
|
+
[input_source.read_contents(close: opts.close_file)] # : Array[untyped]
|
171
162
|
end
|
172
|
-
form_data.push ['include_mvision', 'true'] if all_words
|
163
|
+
form_data.push ['include_mvision', 'true'] if opts.all_words
|
173
164
|
|
174
165
|
req.set_form(form_data, 'multipart/form-data')
|
175
166
|
|
176
|
-
response = nil
|
177
167
|
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: @request_timeout) do |http|
|
178
|
-
|
168
|
+
return http.request(req)
|
179
169
|
end
|
180
|
-
response
|
170
|
+
raise Mindee::Errors::MindeeError, 'Could not resolve server response.'
|
181
171
|
end
|
182
172
|
|
183
173
|
# @param job_id [String]
|
184
174
|
# @return [Net::HTTPResponse, nil]
|
185
|
-
def
|
175
|
+
def document_queue_req_get(job_id)
|
186
176
|
uri = URI("#{@url_root}/documents/queue/#{job_id}")
|
187
177
|
|
188
178
|
headers = {
|
@@ -42,7 +42,7 @@ module Mindee
|
|
42
42
|
# Checks and correct the response object depending on the possible kinds of returns.
|
43
43
|
# @param response [Net::HTTPResponse]
|
44
44
|
def self.clean_request!(response)
|
45
|
-
return response if (response.code.to_i < 200) || (response.code.to_i > 302)
|
45
|
+
return response if (response.code.to_i < 200) || (response.code.to_i > 302) # : Net::HTTPResponse
|
46
46
|
|
47
47
|
return response if response.body.empty?
|
48
48
|
|
@@ -35,7 +35,7 @@ module Mindee
|
|
35
35
|
|
36
36
|
# @param product_class [Mindee::Inference]
|
37
37
|
# @param http_response [Hash]
|
38
|
-
# @param raw_http [
|
38
|
+
# @param raw_http [Hash]
|
39
39
|
def initialize(product_class, http_response, raw_http)
|
40
40
|
logger.debug('Handling API response')
|
41
41
|
@raw_http = raw_http.to_s
|
@@ -69,7 +69,7 @@ module Mindee
|
|
69
69
|
|
70
70
|
full_text_ocr = String.new
|
71
71
|
raw_prediction.dig('inference', 'pages').each do |page|
|
72
|
-
full_text_ocr <<
|
72
|
+
full_text_ocr << page['extras']['full_text_ocr']['content']
|
73
73
|
end
|
74
74
|
artificial_text_obj = { 'content' => full_text_ocr }
|
75
75
|
if @extras.nil? || @extras.empty?
|
@@ -13,6 +13,8 @@ module Mindee
|
|
13
13
|
attr_reader :cropper
|
14
14
|
# @return [Mindee::Parsing::Common::Extras::FullTextOCRExtra, nil]
|
15
15
|
attr_reader :full_text_ocr
|
16
|
+
# @return [RAGExtra, nil]
|
17
|
+
attr_reader :rag
|
16
18
|
|
17
19
|
def initialize(raw_prediction)
|
18
20
|
if raw_prediction['cropper']
|
@@ -21,9 +23,10 @@ module Mindee
|
|
21
23
|
if raw_prediction['full_text_ocr']
|
22
24
|
@full_text_ocr = Mindee::Parsing::Common::Extras::FullTextOCRExtra.new(raw_prediction['full_text_ocr'])
|
23
25
|
end
|
26
|
+
@rag = Mindee::Parsing::Common::Extras::RAGExtra.new(raw_prediction['rag']) if raw_prediction['rag']
|
24
27
|
|
25
28
|
raw_prediction.each do |key, value|
|
26
|
-
instance_variable_set("@#{key}", value) unless ['cropper', 'full_text_ocr'].include?(key)
|
29
|
+
instance_variable_set("@#{key}", value) unless ['cropper', 'full_text_ocr', 'rag'].include?(key)
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mindee
|
4
|
+
module Parsing
|
5
|
+
module Common
|
6
|
+
module Extras
|
7
|
+
# Retrieval-Augmented Generation extra.
|
8
|
+
class RAGExtra
|
9
|
+
# ID of the matching document
|
10
|
+
# @return [String, nil]
|
11
|
+
attr_reader :matching_document_id
|
12
|
+
|
13
|
+
def initialize(raw_prediction)
|
14
|
+
@matching_document_id = raw_prediction['matching_document_id'] if raw_prediction['matching_document_id']
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
@matching_document_id || ''
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -29,6 +29,8 @@ module Mindee
|
|
29
29
|
# Whether this product has access to synchronous endpoint.
|
30
30
|
# @return [bool]
|
31
31
|
attr_reader :has_sync
|
32
|
+
# @return [Mindee::Parsing::Common::Extras::Extras] Potential Extras fields sent back along the prediction.
|
33
|
+
attr_reader :extras
|
32
34
|
|
33
35
|
@endpoint_name = nil
|
34
36
|
@endpoint_version = nil
|
@@ -40,6 +42,7 @@ module Mindee
|
|
40
42
|
@is_rotation_applied = raw_prediction['is_rotation_applied']
|
41
43
|
@product = Product.new(raw_prediction['product'])
|
42
44
|
@pages = [] # : Array[Page]
|
45
|
+
@extras = Extras::Extras.new(raw_prediction['extras'])
|
43
46
|
end
|
44
47
|
|
45
48
|
# @return [String]
|
@@ -39,10 +39,10 @@ module Mindee
|
|
39
39
|
def to_s
|
40
40
|
printable = printable_values
|
41
41
|
out_str = String.new
|
42
|
-
out_str <<
|
43
|
-
out_str <<
|
44
|
-
out_str <<
|
45
|
-
out_str <<
|
42
|
+
out_str << "Base: #{printable[:base]}"
|
43
|
+
out_str << ", Code: #{printable[:code]}"
|
44
|
+
out_str << ", Rate (%): #{printable[:rate]}"
|
45
|
+
out_str << ", Amount: #{printable[:value]}"
|
46
46
|
out_str.strip
|
47
47
|
end
|
48
48
|
|
@@ -60,10 +60,10 @@ module Mindee
|
|
60
60
|
def to_table_line
|
61
61
|
printable = printable_values
|
62
62
|
out_str = String.new
|
63
|
-
out_str <<
|
64
|
-
out_str <<
|
65
|
-
out_str <<
|
66
|
-
out_str <<
|
63
|
+
out_str << "| #{printable[:base].ljust(13, ' ')}"
|
64
|
+
out_str << " | #{printable[:code].ljust(6, ' ')}"
|
65
|
+
out_str << " | #{printable[:rate].ljust(8, ' ')}"
|
66
|
+
out_str << " | #{printable[:value].ljust(13, ' ')} |"
|
67
67
|
out_str.strip
|
68
68
|
end
|
69
69
|
end
|
@@ -94,7 +94,7 @@ module Mindee
|
|
94
94
|
return '' if nil? || empty?
|
95
95
|
|
96
96
|
out_str = String.new
|
97
|
-
out_str <<
|
97
|
+
out_str << "\n#{line_separator('-')}"
|
98
98
|
out_str << "\n | Base | Code | Rate (%) | Amount |"
|
99
99
|
out_str << "\n#{line_separator('=')}"
|
100
100
|
each do |entry|
|
@@ -58,7 +58,7 @@ module Mindee
|
|
58
58
|
end
|
59
59
|
formatted_max_index = format('%03d', page_index_list[page_index_list.length - 1] + 1).to_s
|
60
60
|
field_filename = "#{basename}_#{format('%03d',
|
61
|
-
|
61
|
+
page_index_list[0] + 1)}-#{formatted_max_index}#{extension}"
|
62
62
|
extracted_pdf = Mindee::PDF::PDFExtractor::ExtractedPDF.new(cut_pages(page_index_list),
|
63
63
|
field_filename)
|
64
64
|
extracted_pdfs << extracted_pdf
|
@@ -46,14 +46,14 @@ module Mindee
|
|
46
46
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
47
47
|
end.join
|
48
48
|
out_str = String.new
|
49
|
-
out_str <<
|
49
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
50
50
|
out_str << ' | Description '
|
51
51
|
out_str << ' | Gross Weight'
|
52
52
|
out_str << ' | Measurement'
|
53
53
|
out_str << ' | Measurement Unit'
|
54
54
|
out_str << ' | Quantity'
|
55
55
|
out_str << ' | Weight Unit'
|
56
|
-
out_str <<
|
56
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
57
57
|
out_str + lines
|
58
58
|
end
|
59
59
|
end
|
@@ -44,7 +44,7 @@ module Mindee
|
|
44
44
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
45
45
|
end.join
|
46
46
|
out_str = String.new
|
47
|
-
out_str <<
|
47
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
48
48
|
out_str << ' | Description '
|
49
49
|
out_str << ' | Product code'
|
50
50
|
out_str << ' | Quantity'
|
@@ -53,7 +53,7 @@ module Mindee
|
|
53
53
|
out_str << ' | Total Amount'
|
54
54
|
out_str << ' | Unit of measure'
|
55
55
|
out_str << ' | Unit Price'
|
56
|
-
out_str <<
|
56
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
57
57
|
out_str + lines
|
58
58
|
end
|
59
59
|
end
|
@@ -40,11 +40,11 @@ module Mindee
|
|
40
40
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
41
41
|
end.join
|
42
42
|
out_str = String.new
|
43
|
-
out_str <<
|
43
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
44
44
|
out_str << ' | Amount '
|
45
45
|
out_str << ' | Date '
|
46
46
|
out_str << ' | Description '
|
47
|
-
out_str <<
|
47
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
48
48
|
out_str + lines
|
49
49
|
end
|
50
50
|
end
|
@@ -50,7 +50,7 @@ module Mindee
|
|
50
50
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
51
51
|
end.join
|
52
52
|
out_str = String.new
|
53
|
-
out_str <<
|
53
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
54
54
|
out_str << ' | Consumption'
|
55
55
|
out_str << ' | Description '
|
56
56
|
out_str << ' | End Date '
|
@@ -59,7 +59,7 @@ module Mindee
|
|
59
59
|
out_str << ' | Total '
|
60
60
|
out_str << ' | Unit of Measure'
|
61
61
|
out_str << ' | Unit Price'
|
62
|
-
out_str <<
|
62
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
63
63
|
out_str + lines
|
64
64
|
end
|
65
65
|
end
|
@@ -48,14 +48,14 @@ module Mindee
|
|
48
48
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
49
49
|
end.join
|
50
50
|
out_str = String.new
|
51
|
-
out_str <<
|
51
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
52
52
|
out_str << ' | Description '
|
53
53
|
out_str << ' | End Date '
|
54
54
|
out_str << ' | Start Date'
|
55
55
|
out_str << ' | Tax Rate'
|
56
56
|
out_str << ' | Total '
|
57
57
|
out_str << ' | Unit Price'
|
58
|
-
out_str <<
|
58
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
59
59
|
out_str + lines
|
60
60
|
end
|
61
61
|
end
|
@@ -48,14 +48,14 @@ module Mindee
|
|
48
48
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
49
49
|
end.join
|
50
50
|
out_str = String.new
|
51
|
-
out_str <<
|
51
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
52
52
|
out_str << ' | Description '
|
53
53
|
out_str << ' | End Date '
|
54
54
|
out_str << ' | Start Date'
|
55
55
|
out_str << ' | Tax Rate'
|
56
56
|
out_str << ' | Total '
|
57
57
|
out_str << ' | Unit Price'
|
58
|
-
out_str <<
|
58
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
59
59
|
out_str + lines
|
60
60
|
end
|
61
61
|
end
|
@@ -48,12 +48,12 @@ module Mindee
|
|
48
48
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
49
49
|
end.join
|
50
50
|
out_str = String.new
|
51
|
-
out_str <<
|
51
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
52
52
|
out_str << ' | Amount '
|
53
53
|
out_str << ' | Base '
|
54
54
|
out_str << ' | Description '
|
55
55
|
out_str << ' | Rate '
|
56
|
-
out_str <<
|
56
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
57
57
|
out_str + lines
|
58
58
|
end
|
59
59
|
end
|
@@ -49,13 +49,13 @@ module Mindee
|
|
49
49
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
50
50
|
end.join
|
51
51
|
out_str = String.new
|
52
|
-
out_str <<
|
52
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
53
53
|
out_str << ' | Accrued '
|
54
54
|
out_str << ' | Period'
|
55
55
|
out_str << ' | Type '
|
56
56
|
out_str << ' | Remaining'
|
57
57
|
out_str << ' | Used '
|
58
|
-
out_str <<
|
58
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
59
59
|
out_str + lines
|
60
60
|
end
|
61
61
|
end
|
@@ -49,13 +49,13 @@ module Mindee
|
|
49
49
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
50
50
|
end.join
|
51
51
|
out_str = String.new
|
52
|
-
out_str <<
|
52
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
53
53
|
out_str << ' | Amount '
|
54
54
|
out_str << ' | Base '
|
55
55
|
out_str << ' | Description '
|
56
56
|
out_str << ' | Number'
|
57
57
|
out_str << ' | Rate '
|
58
|
-
out_str <<
|
58
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
59
59
|
out_str + lines
|
60
60
|
end
|
61
61
|
end
|
@@ -44,7 +44,7 @@ module Mindee
|
|
44
44
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
45
45
|
end.join
|
46
46
|
out_str = String.new
|
47
|
-
out_str <<
|
47
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
48
48
|
out_str << ' | Description '
|
49
49
|
out_str << ' | Product code'
|
50
50
|
out_str << ' | Quantity'
|
@@ -53,7 +53,7 @@ module Mindee
|
|
53
53
|
out_str << ' | Total Amount'
|
54
54
|
out_str << ' | Unit of measure'
|
55
55
|
out_str << ' | Unit Price'
|
56
|
-
out_str <<
|
56
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
57
57
|
out_str + lines
|
58
58
|
end
|
59
59
|
end
|
@@ -37,9 +37,9 @@ module Mindee
|
|
37
37
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
38
38
|
end.join
|
39
39
|
out_str = String.new
|
40
|
-
out_str <<
|
40
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
41
41
|
out_str << ' | Page Indexes '
|
42
|
-
out_str <<
|
42
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
43
43
|
out_str + lines
|
44
44
|
end
|
45
45
|
end
|
@@ -53,13 +53,13 @@ module Mindee
|
|
53
53
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
54
54
|
end.join
|
55
55
|
out_str = String.new
|
56
|
-
out_str <<
|
56
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
57
57
|
out_str << ' | Daily Value'
|
58
58
|
out_str << ' | Name '
|
59
59
|
out_str << ' | Per 100g'
|
60
60
|
out_str << ' | Per Serving'
|
61
61
|
out_str << ' | Unit'
|
62
|
-
out_str <<
|
62
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
63
63
|
out_str + lines
|
64
64
|
end
|
65
65
|
end
|
@@ -40,12 +40,12 @@ module Mindee
|
|
40
40
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
41
41
|
end.join
|
42
42
|
out_str = String.new
|
43
|
-
out_str <<
|
43
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
44
44
|
out_str << ' | Description '
|
45
45
|
out_str << ' | Quantity'
|
46
46
|
out_str << ' | Total Amount'
|
47
47
|
out_str << ' | Unit Price'
|
48
|
-
out_str <<
|
48
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
49
49
|
out_str + lines
|
50
50
|
end
|
51
51
|
end
|
@@ -44,12 +44,12 @@ module Mindee
|
|
44
44
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
45
45
|
end.join
|
46
46
|
out_str = String.new
|
47
|
-
out_str <<
|
47
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
48
48
|
out_str << ' | Grade '
|
49
49
|
out_str << ' | Name '
|
50
50
|
out_str << ' | Provider '
|
51
51
|
out_str << ' | Year'
|
52
|
-
out_str <<
|
52
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
53
53
|
out_str + lines
|
54
54
|
end
|
55
55
|
end
|
@@ -47,7 +47,7 @@ module Mindee
|
|
47
47
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
48
48
|
end.join
|
49
49
|
out_str = String.new
|
50
|
-
out_str <<
|
50
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
51
51
|
out_str << ' | Domain '
|
52
52
|
out_str << ' | Degree '
|
53
53
|
out_str << ' | End Month'
|
@@ -55,7 +55,7 @@ module Mindee
|
|
55
55
|
out_str << ' | School '
|
56
56
|
out_str << ' | Start Month'
|
57
57
|
out_str << ' | Start Year'
|
58
|
-
out_str <<
|
58
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
59
59
|
out_str + lines
|
60
60
|
end
|
61
61
|
end
|
@@ -42,10 +42,10 @@ module Mindee
|
|
42
42
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
43
43
|
end.join
|
44
44
|
out_str = String.new
|
45
|
-
out_str <<
|
45
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
46
46
|
out_str << ' | Language'
|
47
47
|
out_str << ' | Level '
|
48
|
-
out_str <<
|
48
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
49
49
|
out_str + lines
|
50
50
|
end
|
51
51
|
end
|
@@ -49,7 +49,7 @@ module Mindee
|
|
49
49
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
50
50
|
end.join
|
51
51
|
out_str = String.new
|
52
|
-
out_str <<
|
52
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
53
53
|
out_str << ' | Contract Type '
|
54
54
|
out_str << ' | Department'
|
55
55
|
out_str << ' | Description '
|
@@ -59,7 +59,7 @@ module Mindee
|
|
59
59
|
out_str << ' | Role '
|
60
60
|
out_str << ' | Start Month'
|
61
61
|
out_str << ' | Start Year'
|
62
|
-
out_str <<
|
62
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
63
63
|
out_str + lines
|
64
64
|
end
|
65
65
|
end
|
@@ -42,10 +42,10 @@ module Mindee
|
|
42
42
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
43
43
|
end.join
|
44
44
|
out_str = String.new
|
45
|
-
out_str <<
|
45
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
46
46
|
out_str << ' | Name '
|
47
47
|
out_str << ' | URL '
|
48
|
-
out_str <<
|
48
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
49
49
|
out_str + lines
|
50
50
|
end
|
51
51
|
end
|
@@ -39,10 +39,10 @@ module Mindee
|
|
39
39
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
40
40
|
end.join
|
41
41
|
out_str = String.new
|
42
|
-
out_str <<
|
42
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
43
43
|
out_str << ' | Service Fees'
|
44
44
|
out_str << ' | Service Name '
|
45
|
-
out_str <<
|
45
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
46
46
|
out_str + lines
|
47
47
|
end
|
48
48
|
end
|
@@ -45,7 +45,7 @@ module Mindee
|
|
45
45
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
46
46
|
end.join
|
47
47
|
out_str = String.new
|
48
|
-
out_str <<
|
48
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
49
49
|
out_str << ' | City '
|
50
50
|
out_str << ' | Complete Address '
|
51
51
|
out_str << ' | Is Address Change'
|
@@ -53,7 +53,7 @@ module Mindee
|
|
53
53
|
out_str << ' | Private Mailbox Number'
|
54
54
|
out_str << ' | State'
|
55
55
|
out_str << ' | Street '
|
56
|
-
out_str <<
|
56
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
57
57
|
out_str + lines
|
58
58
|
end
|
59
59
|
end
|
@@ -46,7 +46,7 @@ module Mindee
|
|
46
46
|
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
47
47
|
end.join
|
48
48
|
out_str = String.new
|
49
|
-
out_str <<
|
49
|
+
out_str << "\n#{self.class.line_items_separator('-')}\n "
|
50
50
|
out_str << ' | City '
|
51
51
|
out_str << ' | Complete Address '
|
52
52
|
out_str << ' | Is Address Change'
|
@@ -55,7 +55,7 @@ module Mindee
|
|
55
55
|
out_str << ' | State'
|
56
56
|
out_str << ' | Street '
|
57
57
|
out_str << ' | Unit '
|
58
|
-
out_str <<
|
58
|
+
out_str << " |\n#{self.class.line_items_separator('=')}"
|
59
59
|
out_str + lines
|
60
60
|
end
|
61
61
|
end
|
data/lib/mindee/version.rb
CHANGED
data/mindee.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency 'rake', '~> 13.2'
|
38
38
|
spec.add_development_dependency 'rbs', '~> 3.6'
|
39
39
|
spec.add_development_dependency 'rspec', '~> 3.13'
|
40
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
40
|
+
spec.add_development_dependency 'rubocop', '~> 1.75'
|
41
41
|
spec.add_development_dependency 'steep', '~> 1.7'
|
42
42
|
spec.add_development_dependency 'yard', '~> 0.9'
|
43
43
|
end
|
data/sig/custom/net_http.rbs
CHANGED
data/sig/mindee/client.rbs
CHANGED
@@ -17,6 +17,8 @@ module Mindee
|
|
17
17
|
attr_accessor close_file: bool
|
18
18
|
attr_accessor page_options: PageOptions
|
19
19
|
attr_accessor cropper: bool
|
20
|
+
attr_accessor rag: bool
|
21
|
+
attr_accessor workflow_id: String | nil
|
20
22
|
attr_accessor initial_delay_sec: Integer | Float
|
21
23
|
attr_accessor delay_sec: Integer | Float
|
22
24
|
attr_accessor max_retries: Integer
|
@@ -36,7 +38,7 @@ module Mindee
|
|
36
38
|
end
|
37
39
|
|
38
40
|
class Client
|
39
|
-
def initialize: (api_key: String) -> void
|
41
|
+
def initialize: (?api_key: String) -> void
|
40
42
|
def logger: () -> untyped
|
41
43
|
def parse: (Input::Source::LocalInputSource | Input::Source::URLInputSource, untyped, ?endpoint: (HTTP::Endpoint?), options: ParseOptions | Hash[Symbol | String, untyped]) -> Parsing::Common::ApiResponse
|
42
44
|
def parse_sync: (Input::Source::LocalInputSource | Input::Source::URLInputSource, untyped, HTTP::Endpoint, ParseOptions) -> Parsing::Common::ApiResponse
|
@@ -57,7 +59,7 @@ module Mindee
|
|
57
59
|
def process_pdf_if_required: (Input::Source::LocalInputSource, ParseOptions | WorkflowOptions) -> void
|
58
60
|
def initialize_endpoint: (singleton(Parsing::Common::Inference), ?endpoint_name: String, ?account_name: String, ?version: String) -> HTTP::Endpoint
|
59
61
|
def validate_async_params: (Integer | Float, Integer | Float, Integer) -> void
|
60
|
-
def fix_endpoint_name: (singleton(Parsing::Common::Inference), String?) -> String
|
62
|
+
def fix_endpoint_name: (singleton(Parsing::Common::Inference), String?) -> String
|
61
63
|
def fix_account_name: (String) -> String
|
62
64
|
def fix_version: (singleton(Parsing::Common::Inference), String) -> String
|
63
65
|
end
|
@@ -13,14 +13,15 @@ module Mindee
|
|
13
13
|
def api_key: -> String?
|
14
14
|
def request_timeout: -> Integer
|
15
15
|
def url_root: -> String
|
16
|
-
def
|
17
|
-
def
|
18
|
-
def
|
19
|
-
def
|
20
|
-
def
|
21
|
-
def
|
22
|
-
def
|
23
|
-
def
|
16
|
+
def base_url: -> String
|
17
|
+
def initialize: (String, String, String | nil, ?api_key: String) -> String
|
18
|
+
def predict: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> [Net::HTTPResponse, Hash[Symbol, untyped]]
|
19
|
+
def predict_async: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> [Net::HTTPResponse, Hash[Symbol, untyped]]
|
20
|
+
def parse_async: (String) -> [Net::HTTPResponse, Hash[Symbol, untyped]]
|
21
|
+
def predict_req_post: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> Net::HTTPResponse
|
22
|
+
def document_queue_req_post: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> Net::HTTPResponse
|
23
|
+
def document_queue_req_get: (untyped) -> Net::HTTPResponse
|
24
|
+
def check_api_key: -> void
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
module Mindee
|
3
3
|
module HTTP
|
4
4
|
module ResponseValidation
|
5
|
-
def self.valid_sync_response?: (
|
6
|
-
def self.valid_async_response?: (
|
7
|
-
def self.clean_request!: (
|
5
|
+
def self.valid_sync_response?: (Net::HTTPResponse) -> bool
|
6
|
+
def self.valid_async_response?: (Net::HTTPResponse) -> bool
|
7
|
+
def self.clean_request!: (Net::HTTPResponse) -> void
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -20,7 +20,7 @@ module Mindee
|
|
20
20
|
def job: -> Parsing::Common::Job?
|
21
21
|
def api_request: -> Parsing::Common::ApiRequest?
|
22
22
|
def raw_http: -> String
|
23
|
-
def initialize: (singleton(Parsing::Common::Inference), Hash[Symbol | String, untyped], String) -> void
|
23
|
+
def initialize: (singleton(Parsing::Common::Inference), Hash[Symbol | String, untyped] | Net::HTTPResponse, String) -> void
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# lib/mindee/parsing/common/extras/rag_extra.rb
|
2
|
+
|
3
|
+
module Mindee
|
4
|
+
module Parsing
|
5
|
+
module Common
|
6
|
+
module Extras
|
7
|
+
class RAGExtra
|
8
|
+
def matching_document_id: -> String?
|
9
|
+
def initialize: (untyped) -> nil
|
10
|
+
def to_s: -> String
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
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.
|
4
|
+
version: 4.4.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-04-
|
11
|
+
date: 2025-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -148,14 +148,14 @@ dependencies:
|
|
148
148
|
requirements:
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: '1.
|
151
|
+
version: '1.75'
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: '1.
|
158
|
+
version: '1.75'
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
160
|
name: steep
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,6 +246,7 @@ files:
|
|
246
246
|
- docs/code_samples/us_mail_v2_async.txt
|
247
247
|
- docs/code_samples/us_mail_v3_async.txt
|
248
248
|
- docs/code_samples/workflow_execution.txt
|
249
|
+
- docs/code_samples/workflow_polling.txt
|
249
250
|
- docs/getting_started.md
|
250
251
|
- docs/global_products.md
|
251
252
|
- docs/global_products/barcode_reader_v1.md
|
@@ -327,6 +328,7 @@ files:
|
|
327
328
|
- lib/mindee/parsing/common/extras/cropper_extra.rb
|
328
329
|
- lib/mindee/parsing/common/extras/extras.rb
|
329
330
|
- lib/mindee/parsing/common/extras/full_text_ocr_extra.rb
|
331
|
+
- lib/mindee/parsing/common/extras/rag_extra.rb
|
330
332
|
- lib/mindee/parsing/common/inference.rb
|
331
333
|
- lib/mindee/parsing/common/job.rb
|
332
334
|
- lib/mindee/parsing/common/ocr.rb
|
@@ -575,6 +577,7 @@ files:
|
|
575
577
|
- sig/mindee/parsing/common/extras/cropper_extra.rbs
|
576
578
|
- sig/mindee/parsing/common/extras/extras.rbs
|
577
579
|
- sig/mindee/parsing/common/extras/full_text_ocr_extra.rbs
|
580
|
+
- sig/mindee/parsing/common/extras/rag_extra.rbs
|
578
581
|
- sig/mindee/parsing/common/inference.rbs
|
579
582
|
- sig/mindee/parsing/common/job.rbs
|
580
583
|
- sig/mindee/parsing/common/ocr/mvision_v1.rbs
|