-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathv2_extraction.txt
More file actions
42 lines (33 loc) · 1.08 KB
/
v2_extraction.txt
File metadata and controls
42 lines (33 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true
require 'mindee'
require 'mindee/v2/product'
input_path = '/path/to/the/file.ext'
api_key = 'MY_API_KEY'
model_id = 'MY_MODEL_ID'
# Init a new client
mindee_client = Mindee::ClientV2.new(api_key: api_key)
# Set inference parameters
extraction_params = {
# ID of the model, required.
model_id: model_id,
# Options: set to `true` or `false` to override defaults
# Enhance extraction accuracy with Retrieval-Augmented Generation.
rag: nil,
# Extract the full text content from the document as strings.
raw_text: nil,
# Calculate bounding box polygons for all fields.
polygon: nil,
# Boost the precision and accuracy of all extractions.
# Calculate confidence scores for all fields.
confidence: nil
}
# Load a file from disk
input_source = Mindee::Input::Source::PathInputSource.new(input_path)
# Send for processing
response = mindee_client.enqueue_and_get_result(
Mindee::V2::Product::Extraction::Extraction,
input_source,
extraction_params
)
# Print a brief summary of the parsed data
puts response.inference