retab 0.1.4 → 0.1.5
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/lib/retab/classifications/classification.rb +6 -0
- data/lib/retab/classifications/classification_request.rb +5 -2
- data/lib/retab/{jobs/job_error.rb → classifications/primitive_error.rb} +1 -1
- data/lib/retab/classifications.rb +38 -1
- data/lib/retab/client.rb +0 -4
- data/lib/retab/edits/edit.rb +6 -0
- data/lib/retab/edits/edit_request.rb +5 -2
- data/lib/retab/edits.rb +38 -1
- data/lib/retab/extractions/extraction.rb +6 -0
- data/lib/retab/extractions/extraction_request.rb +3 -0
- data/lib/retab/extractions.rb +37 -0
- data/lib/retab/parses/parse.rb +6 -0
- data/lib/retab/parses/parse_request.rb +5 -2
- data/lib/retab/parses.rb +33 -1
- data/lib/retab/partitions/partition.rb +6 -0
- data/lib/retab/partitions/partition_request.rb +5 -2
- data/lib/retab/partitions.rb +38 -1
- data/lib/retab/splits/split.rb +6 -0
- data/lib/retab/splits/split_request.rb +5 -2
- data/lib/retab/splits.rb +38 -1
- data/lib/retab/types/{job_status.rb → classification_status.rb} +3 -4
- data/lib/retab/types/classification_workflow_artifact_status.rb +9 -0
- data/lib/retab/types/{supported_endpoint.rb → classifications_status.rb} +1 -1
- data/lib/retab/types/{jobs_order.rb → edit_status.rb} +1 -1
- data/lib/retab/types/edit_workflow_artifact_status.rb +9 -0
- data/lib/retab/types/{jobs_status.rb → edits_status.rb} +1 -1
- data/lib/retab/types/{jobs_endpoint.rb → extraction_status.rb} +1 -1
- data/lib/retab/types/extraction_workflow_artifact_status.rb +9 -0
- data/lib/retab/types/extractions_status.rb +9 -0
- data/lib/retab/types/parse_status.rb +9 -0
- data/lib/retab/types/parse_workflow_artifact_status.rb +9 -0
- data/lib/retab/types/partition_status.rb +9 -0
- data/lib/retab/types/partition_workflow_artifact_status.rb +9 -0
- data/lib/retab/types/partitions_status.rb +9 -0
- data/lib/retab/types/split_status.rb +9 -0
- data/lib/retab/types/split_workflow_artifact_status.rb +9 -0
- data/lib/retab/types/splits_status.rb +9 -0
- data/lib/retab/workflow_artifacts/classification_workflow_artifact.rb +6 -0
- data/lib/retab/workflow_artifacts/edit_workflow_artifact.rb +6 -0
- data/lib/retab/workflow_artifacts/extraction_workflow_artifact.rb +6 -0
- data/lib/retab/workflow_artifacts/parse_workflow_artifact.rb +6 -0
- data/lib/retab/workflow_artifacts/partition_workflow_artifact.rb +6 -0
- data/lib/retab/workflow_artifacts/split_workflow_artifact.rb +6 -0
- data/lib/retab/workflow_steps.rb +2 -2
- data/lib/retab.rb +0 -1
- data/rbi/retab/classification.rbi +14 -2
- data/rbi/retab/classification_request.rbi +6 -0
- data/rbi/retab/classification_workflow_artifact.rbi +14 -2
- data/rbi/retab/classifications.rbi +14 -3
- data/rbi/retab/client.rbi +0 -3
- data/rbi/retab/edit.rbi +14 -2
- data/rbi/retab/edit_request.rbi +6 -0
- data/rbi/retab/edit_workflow_artifact.rbi +14 -2
- data/rbi/retab/edits.rbi +14 -3
- data/rbi/retab/extraction.rbi +12 -0
- data/rbi/retab/extraction_request.rbi +6 -0
- data/rbi/retab/extraction_workflow_artifact.rbi +12 -0
- data/rbi/retab/extractions.rbi +14 -3
- data/rbi/retab/parse.rbi +12 -0
- data/rbi/retab/parse_request.rbi +6 -0
- data/rbi/retab/parse_workflow_artifact.rbi +12 -0
- data/rbi/retab/parses.rbi +12 -2
- data/rbi/retab/partition.rbi +12 -0
- data/rbi/retab/partition_request.rbi +6 -0
- data/rbi/retab/partition_workflow_artifact.rbi +12 -0
- data/rbi/retab/partitions.rbi +14 -3
- data/rbi/retab/{job_error.rbi → primitive_error.rbi} +1 -1
- data/rbi/retab/split.rbi +14 -2
- data/rbi/retab/split_request.rbi +6 -0
- data/rbi/retab/split_workflow_artifact.rbi +14 -2
- data/rbi/retab/splits.rbi +14 -3
- metadata +20 -20
- data/lib/retab/jobs/create_job_request.rb +0 -28
- data/lib/retab/jobs/job.rb +0 -70
- data/lib/retab/jobs/job_response.rb +0 -25
- data/lib/retab/jobs/job_warning.rb +0 -7
- data/lib/retab/jobs.rb +0 -252
- data/lib/retab/types/create_job_request_endpoint.rb +0 -34
- data/lib/retab/types/jobs_source.rb +0 -14
- data/rbi/retab/create_job_request.rbi +0 -36
- data/rbi/retab/job.rbi +0 -120
- data/rbi/retab/job_response.rbi +0 -30
- data/rbi/retab/job_warning.rbi +0 -36
- data/rbi/retab/jobs.rbi +0 -76
|
@@ -14,6 +14,8 @@ module Retab
|
|
|
14
14
|
n_consensus: :n_consensus,
|
|
15
15
|
allow_overlap: :allow_overlap,
|
|
16
16
|
output: :output,
|
|
17
|
+
status: :status,
|
|
18
|
+
error: :error,
|
|
17
19
|
consensus: :consensus,
|
|
18
20
|
usage: :usage,
|
|
19
21
|
created_at: :created_at
|
|
@@ -28,6 +30,8 @@ module Retab
|
|
|
28
30
|
:n_consensus,
|
|
29
31
|
:allow_overlap,
|
|
30
32
|
:output,
|
|
33
|
+
:status,
|
|
34
|
+
:error,
|
|
31
35
|
:consensus,
|
|
32
36
|
:usage,
|
|
33
37
|
:created_at
|
|
@@ -44,6 +48,8 @@ module Retab
|
|
|
44
48
|
@n_consensus = hash[:n_consensus]
|
|
45
49
|
@allow_overlap = hash[:allow_overlap].nil? ? true : hash[:allow_overlap]
|
|
46
50
|
@output = (hash[:output] || []).map { |item| item ? Retab::PartitionChunk.new(item) : nil }
|
|
51
|
+
@status = hash[:status].nil? ? "pending" : hash[:status]
|
|
52
|
+
@error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil
|
|
47
53
|
@consensus = hash[:consensus] ? Retab::PartitionConsensus.new(hash[:consensus]) : nil
|
|
48
54
|
@usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
|
|
49
55
|
@created_at = hash[:created_at]
|
|
@@ -12,7 +12,8 @@ module Retab
|
|
|
12
12
|
model: :model,
|
|
13
13
|
n_consensus: :n_consensus,
|
|
14
14
|
allow_overlap: :allow_overlap,
|
|
15
|
-
bust_cache: :bust_cache
|
|
15
|
+
bust_cache: :bust_cache,
|
|
16
|
+
background: :background
|
|
16
17
|
}.freeze
|
|
17
18
|
|
|
18
19
|
attr_accessor(
|
|
@@ -22,7 +23,8 @@ module Retab
|
|
|
22
23
|
:model,
|
|
23
24
|
:n_consensus,
|
|
24
25
|
:allow_overlap,
|
|
25
|
-
:bust_cache
|
|
26
|
+
:bust_cache,
|
|
27
|
+
:background
|
|
26
28
|
)
|
|
27
29
|
|
|
28
30
|
def initialize(json)
|
|
@@ -35,6 +37,7 @@ module Retab
|
|
|
35
37
|
@n_consensus = hash[:n_consensus]
|
|
36
38
|
@allow_overlap = hash[:allow_overlap].nil? ? true : hash[:allow_overlap]
|
|
37
39
|
@bust_cache = hash[:bust_cache].nil? ? false : hash[:bust_cache]
|
|
40
|
+
@background = hash[:background].nil? ? false : hash[:background]
|
|
38
41
|
end
|
|
39
42
|
end
|
|
40
43
|
end
|
data/lib/retab/partitions.rb
CHANGED
|
@@ -16,6 +16,7 @@ module Retab
|
|
|
16
16
|
# @param limit [Integer, nil]
|
|
17
17
|
# @param order [Retab::Types::PartitionsOrder, nil]
|
|
18
18
|
# @param filename [String, nil]
|
|
19
|
+
# @param status [Retab::Types::PartitionsStatus, nil]
|
|
19
20
|
# @param from_date [String, nil]
|
|
20
21
|
# @param to_date [String, nil]
|
|
21
22
|
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
@@ -26,6 +27,7 @@ module Retab
|
|
|
26
27
|
limit: 10,
|
|
27
28
|
order: "desc",
|
|
28
29
|
filename: nil,
|
|
30
|
+
status: nil,
|
|
29
31
|
from_date: nil,
|
|
30
32
|
to_date: nil,
|
|
31
33
|
request_options: {}
|
|
@@ -36,6 +38,7 @@ module Retab
|
|
|
36
38
|
"limit" => limit,
|
|
37
39
|
"order" => order,
|
|
38
40
|
"filename" => filename,
|
|
41
|
+
"status" => status,
|
|
39
42
|
"from_date" => from_date,
|
|
40
43
|
"to_date" => to_date
|
|
41
44
|
}.compact
|
|
@@ -53,6 +56,7 @@ module Retab
|
|
|
53
56
|
limit: limit,
|
|
54
57
|
order: order,
|
|
55
58
|
filename: filename,
|
|
59
|
+
status: status,
|
|
56
60
|
from_date: from_date,
|
|
57
61
|
to_date: to_date,
|
|
58
62
|
request_options: request_options
|
|
@@ -66,6 +70,7 @@ module Retab
|
|
|
66
70
|
limit: limit,
|
|
67
71
|
order: order,
|
|
68
72
|
filename: filename,
|
|
73
|
+
status: status,
|
|
69
74
|
from_date: from_date,
|
|
70
75
|
to_date: to_date
|
|
71
76
|
},
|
|
@@ -81,6 +86,7 @@ module Retab
|
|
|
81
86
|
# @param n_consensus [Integer, nil] Number of partitioning runs to use for consensus voting. Uses deterministic single-pass when set to 1.
|
|
82
87
|
# @param allow_overlap [Boolean, nil] If true, allow a page to appear in more than one partition chunk
|
|
83
88
|
# @param bust_cache [Boolean, nil] If true, skip the LLM cache and force a fresh completion
|
|
89
|
+
# @param background [Boolean, nil] If true, run asynchronously: returns immediately with status 'queued' and an empty output. Poll GET /v1/<primitive>/{id} until status is terminal. Mutually exclusive with stream.
|
|
84
90
|
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
85
91
|
# @return [Retab::Partition]
|
|
86
92
|
def create(
|
|
@@ -91,6 +97,7 @@ module Retab
|
|
|
91
97
|
n_consensus: nil,
|
|
92
98
|
allow_overlap: nil,
|
|
93
99
|
bust_cache: nil,
|
|
100
|
+
background: nil,
|
|
94
101
|
request_options: {}
|
|
95
102
|
)
|
|
96
103
|
document = Retab::MimeData.coerce(document) unless document.nil?
|
|
@@ -101,7 +108,8 @@ module Retab
|
|
|
101
108
|
"model" => model,
|
|
102
109
|
"n_consensus" => n_consensus,
|
|
103
110
|
"allow_overlap" => allow_overlap,
|
|
104
|
-
"bust_cache" => bust_cache
|
|
111
|
+
"bust_cache" => bust_cache,
|
|
112
|
+
"background" => background
|
|
105
113
|
}.compact
|
|
106
114
|
response = @client.request(
|
|
107
115
|
method: :post,
|
|
@@ -121,16 +129,22 @@ module Retab
|
|
|
121
129
|
|
|
122
130
|
# Get Partition
|
|
123
131
|
# @param partition_id [String]
|
|
132
|
+
# @param include_output [Boolean, nil] When false, returns a cheap status-only projection (no output), served from cache for in-flight background runs.
|
|
124
133
|
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
125
134
|
# @return [Retab::Partition]
|
|
126
135
|
def get(
|
|
127
136
|
partition_id:,
|
|
137
|
+
include_output: true,
|
|
128
138
|
request_options: {}
|
|
129
139
|
)
|
|
140
|
+
params = {
|
|
141
|
+
"include_output" => include_output
|
|
142
|
+
}.compact
|
|
130
143
|
response = @client.request(
|
|
131
144
|
method: :get,
|
|
132
145
|
path: "/v1/partitions/#{Retab::Util.encode_path(partition_id)}",
|
|
133
146
|
auth: true,
|
|
147
|
+
params: params,
|
|
134
148
|
request_options: request_options
|
|
135
149
|
)
|
|
136
150
|
result = Retab::Partition.new(response.body)
|
|
@@ -158,5 +172,28 @@ module Retab
|
|
|
158
172
|
)
|
|
159
173
|
nil
|
|
160
174
|
end
|
|
175
|
+
|
|
176
|
+
# Cancel Partition
|
|
177
|
+
# @param partition_id [String]
|
|
178
|
+
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
179
|
+
# @return [Retab::Partition]
|
|
180
|
+
def create_partition_cancel(
|
|
181
|
+
partition_id:,
|
|
182
|
+
request_options: {}
|
|
183
|
+
)
|
|
184
|
+
response = @client.request(
|
|
185
|
+
method: :post,
|
|
186
|
+
path: "/v1/partitions/#{Retab::Util.encode_path(partition_id)}/cancel",
|
|
187
|
+
auth: true,
|
|
188
|
+
request_options: request_options
|
|
189
|
+
)
|
|
190
|
+
result = Retab::Partition.new(response.body)
|
|
191
|
+
result.last_response = Retab::Types::ApiResponse.new(
|
|
192
|
+
http_status: response.code.to_i,
|
|
193
|
+
http_headers: response.each_header.to_h,
|
|
194
|
+
request_id: response["x-request-id"]
|
|
195
|
+
)
|
|
196
|
+
result
|
|
197
|
+
end
|
|
161
198
|
end
|
|
162
199
|
end
|
data/lib/retab/splits/split.rb
CHANGED
|
@@ -13,6 +13,8 @@ module Retab
|
|
|
13
13
|
n_consensus: :n_consensus,
|
|
14
14
|
instructions: :instructions,
|
|
15
15
|
output: :output,
|
|
16
|
+
status: :status,
|
|
17
|
+
error: :error,
|
|
16
18
|
consensus: :consensus,
|
|
17
19
|
usage: :usage,
|
|
18
20
|
created_at: :created_at
|
|
@@ -26,6 +28,8 @@ module Retab
|
|
|
26
28
|
:n_consensus,
|
|
27
29
|
:instructions,
|
|
28
30
|
:output,
|
|
31
|
+
:status,
|
|
32
|
+
:error,
|
|
29
33
|
:consensus,
|
|
30
34
|
:usage,
|
|
31
35
|
:created_at
|
|
@@ -41,6 +45,8 @@ module Retab
|
|
|
41
45
|
@n_consensus = hash[:n_consensus]
|
|
42
46
|
@instructions = hash[:instructions]
|
|
43
47
|
@output = (hash[:output] || []).map { |item| item ? Retab::SplitResult.new(item) : nil }
|
|
48
|
+
@status = hash[:status].nil? ? "pending" : hash[:status]
|
|
49
|
+
@error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil
|
|
44
50
|
@consensus = hash[:consensus] ? Retab::SplitConsensus.new(hash[:consensus]) : nil
|
|
45
51
|
@usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
|
|
46
52
|
@created_at = hash[:created_at]
|
|
@@ -11,7 +11,8 @@ module Retab
|
|
|
11
11
|
model: :model,
|
|
12
12
|
instructions: :instructions,
|
|
13
13
|
n_consensus: :n_consensus,
|
|
14
|
-
bust_cache: :bust_cache
|
|
14
|
+
bust_cache: :bust_cache,
|
|
15
|
+
background: :background
|
|
15
16
|
}.freeze
|
|
16
17
|
|
|
17
18
|
attr_accessor(
|
|
@@ -20,7 +21,8 @@ module Retab
|
|
|
20
21
|
:model,
|
|
21
22
|
:instructions,
|
|
22
23
|
:n_consensus,
|
|
23
|
-
:bust_cache
|
|
24
|
+
:bust_cache,
|
|
25
|
+
:background
|
|
24
26
|
)
|
|
25
27
|
|
|
26
28
|
def initialize(json)
|
|
@@ -32,6 +34,7 @@ module Retab
|
|
|
32
34
|
@instructions = hash[:instructions]
|
|
33
35
|
@n_consensus = hash[:n_consensus]
|
|
34
36
|
@bust_cache = hash[:bust_cache].nil? ? false : hash[:bust_cache]
|
|
37
|
+
@background = hash[:background].nil? ? false : hash[:background]
|
|
35
38
|
end
|
|
36
39
|
end
|
|
37
40
|
end
|
data/lib/retab/splits.rb
CHANGED
|
@@ -16,6 +16,7 @@ module Retab
|
|
|
16
16
|
# @param limit [Integer, nil]
|
|
17
17
|
# @param order [Retab::Types::SplitsOrder, nil]
|
|
18
18
|
# @param filename [String, nil]
|
|
19
|
+
# @param status [Retab::Types::SplitsStatus, nil]
|
|
19
20
|
# @param from_date [String, nil]
|
|
20
21
|
# @param to_date [String, nil]
|
|
21
22
|
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
@@ -26,6 +27,7 @@ module Retab
|
|
|
26
27
|
limit: 10,
|
|
27
28
|
order: "desc",
|
|
28
29
|
filename: nil,
|
|
30
|
+
status: nil,
|
|
29
31
|
from_date: nil,
|
|
30
32
|
to_date: nil,
|
|
31
33
|
request_options: {}
|
|
@@ -36,6 +38,7 @@ module Retab
|
|
|
36
38
|
"limit" => limit,
|
|
37
39
|
"order" => order,
|
|
38
40
|
"filename" => filename,
|
|
41
|
+
"status" => status,
|
|
39
42
|
"from_date" => from_date,
|
|
40
43
|
"to_date" => to_date
|
|
41
44
|
}.compact
|
|
@@ -53,6 +56,7 @@ module Retab
|
|
|
53
56
|
limit: limit,
|
|
54
57
|
order: order,
|
|
55
58
|
filename: filename,
|
|
59
|
+
status: status,
|
|
56
60
|
from_date: from_date,
|
|
57
61
|
to_date: to_date,
|
|
58
62
|
request_options: request_options
|
|
@@ -66,6 +70,7 @@ module Retab
|
|
|
66
70
|
limit: limit,
|
|
67
71
|
order: order,
|
|
68
72
|
filename: filename,
|
|
73
|
+
status: status,
|
|
69
74
|
from_date: from_date,
|
|
70
75
|
to_date: to_date
|
|
71
76
|
},
|
|
@@ -80,6 +85,7 @@ module Retab
|
|
|
80
85
|
# @param instructions [String, nil] Free-form instructions appended to the system prompt to steer the split.
|
|
81
86
|
# @param n_consensus [Integer, nil] Number of consensus split runs to perform. Uses deterministic single-pass when set to 1.
|
|
82
87
|
# @param bust_cache [Boolean, nil] If true, skip the LLM cache and force a fresh completion
|
|
88
|
+
# @param background [Boolean, nil] If true, run asynchronously: returns immediately with status 'queued' and an empty output. Poll GET /v1/<primitive>/{id} until status is terminal. Mutually exclusive with stream.
|
|
83
89
|
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
84
90
|
# @return [Retab::Split]
|
|
85
91
|
def create(
|
|
@@ -89,6 +95,7 @@ module Retab
|
|
|
89
95
|
instructions: nil,
|
|
90
96
|
n_consensus: nil,
|
|
91
97
|
bust_cache: nil,
|
|
98
|
+
background: nil,
|
|
92
99
|
request_options: {}
|
|
93
100
|
)
|
|
94
101
|
document = Retab::MimeData.coerce(document) unless document.nil?
|
|
@@ -98,7 +105,8 @@ module Retab
|
|
|
98
105
|
"model" => model,
|
|
99
106
|
"instructions" => instructions,
|
|
100
107
|
"n_consensus" => n_consensus,
|
|
101
|
-
"bust_cache" => bust_cache
|
|
108
|
+
"bust_cache" => bust_cache,
|
|
109
|
+
"background" => background
|
|
102
110
|
}.compact
|
|
103
111
|
response = @client.request(
|
|
104
112
|
method: :post,
|
|
@@ -118,16 +126,22 @@ module Retab
|
|
|
118
126
|
|
|
119
127
|
# Get Split
|
|
120
128
|
# @param split_id [String]
|
|
129
|
+
# @param include_output [Boolean, nil] When false, returns a cheap status-only projection (no output), served from cache for in-flight background runs.
|
|
121
130
|
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
122
131
|
# @return [Retab::Split]
|
|
123
132
|
def get(
|
|
124
133
|
split_id:,
|
|
134
|
+
include_output: true,
|
|
125
135
|
request_options: {}
|
|
126
136
|
)
|
|
137
|
+
params = {
|
|
138
|
+
"include_output" => include_output
|
|
139
|
+
}.compact
|
|
127
140
|
response = @client.request(
|
|
128
141
|
method: :get,
|
|
129
142
|
path: "/v1/splits/#{Retab::Util.encode_path(split_id)}",
|
|
130
143
|
auth: true,
|
|
144
|
+
params: params,
|
|
131
145
|
request_options: request_options
|
|
132
146
|
)
|
|
133
147
|
result = Retab::Split.new(response.body)
|
|
@@ -155,5 +169,28 @@ module Retab
|
|
|
155
169
|
)
|
|
156
170
|
nil
|
|
157
171
|
end
|
|
172
|
+
|
|
173
|
+
# Cancel Split
|
|
174
|
+
# @param split_id [String]
|
|
175
|
+
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
176
|
+
# @return [Retab::Split]
|
|
177
|
+
def create_split_cancel(
|
|
178
|
+
split_id:,
|
|
179
|
+
request_options: {}
|
|
180
|
+
)
|
|
181
|
+
response = @client.request(
|
|
182
|
+
method: :post,
|
|
183
|
+
path: "/v1/splits/#{Retab::Util.encode_path(split_id)}/cancel",
|
|
184
|
+
auth: true,
|
|
185
|
+
request_options: request_options
|
|
186
|
+
)
|
|
187
|
+
result = Retab::Split.new(response.body)
|
|
188
|
+
result.last_response = Retab::Types::ApiResponse.new(
|
|
189
|
+
http_status: response.code.to_i,
|
|
190
|
+
http_headers: response.each_header.to_h,
|
|
191
|
+
request_id: response["x-request-id"]
|
|
192
|
+
)
|
|
193
|
+
result
|
|
194
|
+
end
|
|
158
195
|
end
|
|
159
196
|
end
|
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
module Retab
|
|
6
6
|
module Types
|
|
7
|
-
class
|
|
8
|
-
|
|
7
|
+
class ClassificationStatus
|
|
8
|
+
PENDING = "pending"
|
|
9
9
|
QUEUED = "queued"
|
|
10
10
|
IN_PROGRESS = "in_progress"
|
|
11
11
|
COMPLETED = "completed"
|
|
12
12
|
FAILED = "failed"
|
|
13
13
|
CANCELLED = "cancelled"
|
|
14
|
-
|
|
15
|
-
ALL = [VALIDATING, QUEUED, IN_PROGRESS, COMPLETED, FAILED, CANCELLED, EXPIRED].freeze
|
|
14
|
+
ALL = [PENDING, QUEUED, IN_PROGRESS, COMPLETED, FAILED, CANCELLED].freeze
|
|
16
15
|
end
|
|
17
16
|
end
|
|
18
17
|
end
|
|
@@ -13,6 +13,8 @@ module Retab
|
|
|
13
13
|
n_consensus: :n_consensus,
|
|
14
14
|
instructions: :instructions,
|
|
15
15
|
output: :output,
|
|
16
|
+
status: :status,
|
|
17
|
+
error: :error,
|
|
16
18
|
consensus: :consensus,
|
|
17
19
|
usage: :usage,
|
|
18
20
|
created_at: :created_at,
|
|
@@ -27,6 +29,8 @@ module Retab
|
|
|
27
29
|
:n_consensus,
|
|
28
30
|
:instructions,
|
|
29
31
|
:output,
|
|
32
|
+
:status,
|
|
33
|
+
:error,
|
|
30
34
|
:consensus,
|
|
31
35
|
:usage,
|
|
32
36
|
:created_at,
|
|
@@ -43,6 +47,8 @@ module Retab
|
|
|
43
47
|
@n_consensus = hash[:n_consensus]
|
|
44
48
|
@instructions = hash[:instructions]
|
|
45
49
|
@output = hash[:output] ? Retab::ClassificationDecision.new(hash[:output]) : nil
|
|
50
|
+
@status = hash[:status].nil? ? "pending" : hash[:status]
|
|
51
|
+
@error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil
|
|
46
52
|
@consensus = hash[:consensus] ? Retab::ClassificationConsensus.new(hash[:consensus]) : nil
|
|
47
53
|
@usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
|
|
48
54
|
@created_at = hash[:created_at]
|
|
@@ -13,6 +13,8 @@ module Retab
|
|
|
13
13
|
config: :config,
|
|
14
14
|
template_id: :template_id,
|
|
15
15
|
output: :output,
|
|
16
|
+
status: :status,
|
|
17
|
+
error: :error,
|
|
16
18
|
filled_document_ref: :filled_document_ref,
|
|
17
19
|
usage: :usage,
|
|
18
20
|
created_at: :created_at,
|
|
@@ -27,6 +29,8 @@ module Retab
|
|
|
27
29
|
:config,
|
|
28
30
|
:template_id,
|
|
29
31
|
:output,
|
|
32
|
+
:status,
|
|
33
|
+
:error,
|
|
30
34
|
:filled_document_ref,
|
|
31
35
|
:usage,
|
|
32
36
|
:created_at,
|
|
@@ -43,6 +47,8 @@ module Retab
|
|
|
43
47
|
@config = hash[:config] ? Retab::EditConfig.new(hash[:config]) : nil
|
|
44
48
|
@template_id = hash[:template_id]
|
|
45
49
|
@output = hash[:output] ? Retab::EditResult.new(hash[:output]) : nil
|
|
50
|
+
@status = hash[:status].nil? ? "pending" : hash[:status]
|
|
51
|
+
@error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil
|
|
46
52
|
@filled_document_ref = hash[:filled_document_ref] ? Retab::FileRef.new(hash[:filled_document_ref]) : nil
|
|
47
53
|
@usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
|
|
48
54
|
@created_at = hash[:created_at]
|
|
@@ -14,6 +14,8 @@ module Retab
|
|
|
14
14
|
image_resolution_dpi: :image_resolution_dpi,
|
|
15
15
|
instructions: :instructions,
|
|
16
16
|
output: :output,
|
|
17
|
+
status: :status,
|
|
18
|
+
error: :error,
|
|
17
19
|
consensus: :consensus,
|
|
18
20
|
metadata: :metadata,
|
|
19
21
|
usage: :usage,
|
|
@@ -30,6 +32,8 @@ module Retab
|
|
|
30
32
|
:image_resolution_dpi,
|
|
31
33
|
:instructions,
|
|
32
34
|
:output,
|
|
35
|
+
:status,
|
|
36
|
+
:error,
|
|
33
37
|
:consensus,
|
|
34
38
|
:metadata,
|
|
35
39
|
:usage,
|
|
@@ -48,6 +52,8 @@ module Retab
|
|
|
48
52
|
@image_resolution_dpi = hash[:image_resolution_dpi]
|
|
49
53
|
@instructions = hash[:instructions]
|
|
50
54
|
@output = hash[:output] || {}
|
|
55
|
+
@status = hash[:status].nil? ? "pending" : hash[:status]
|
|
56
|
+
@error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil
|
|
51
57
|
@consensus = hash[:consensus] ? Retab::ExtractionConsensus.new(hash[:consensus]) : nil
|
|
52
58
|
@metadata = hash[:metadata] || {}
|
|
53
59
|
@usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
|
|
@@ -13,6 +13,8 @@ module Retab
|
|
|
13
13
|
image_resolution_dpi: :image_resolution_dpi,
|
|
14
14
|
instructions: :instructions,
|
|
15
15
|
output: :output,
|
|
16
|
+
status: :status,
|
|
17
|
+
error: :error,
|
|
16
18
|
usage: :usage,
|
|
17
19
|
created_at: :created_at,
|
|
18
20
|
operation: :operation
|
|
@@ -26,6 +28,8 @@ module Retab
|
|
|
26
28
|
:image_resolution_dpi,
|
|
27
29
|
:instructions,
|
|
28
30
|
:output,
|
|
31
|
+
:status,
|
|
32
|
+
:error,
|
|
29
33
|
:usage,
|
|
30
34
|
:created_at,
|
|
31
35
|
:operation
|
|
@@ -41,6 +45,8 @@ module Retab
|
|
|
41
45
|
@image_resolution_dpi = hash[:image_resolution_dpi]
|
|
42
46
|
@instructions = hash[:instructions]
|
|
43
47
|
@output = hash[:output] ? Retab::ParseOutput.new(hash[:output]) : nil
|
|
48
|
+
@status = hash[:status].nil? ? "pending" : hash[:status]
|
|
49
|
+
@error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil
|
|
44
50
|
@usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
|
|
45
51
|
@created_at = hash[:created_at]
|
|
46
52
|
@operation = hash[:operation].nil? ? "parse" : hash[:operation]
|
|
@@ -14,6 +14,8 @@ module Retab
|
|
|
14
14
|
n_consensus: :n_consensus,
|
|
15
15
|
allow_overlap: :allow_overlap,
|
|
16
16
|
output: :output,
|
|
17
|
+
status: :status,
|
|
18
|
+
error: :error,
|
|
17
19
|
consensus: :consensus,
|
|
18
20
|
usage: :usage,
|
|
19
21
|
created_at: :created_at,
|
|
@@ -29,6 +31,8 @@ module Retab
|
|
|
29
31
|
:n_consensus,
|
|
30
32
|
:allow_overlap,
|
|
31
33
|
:output,
|
|
34
|
+
:status,
|
|
35
|
+
:error,
|
|
32
36
|
:consensus,
|
|
33
37
|
:usage,
|
|
34
38
|
:created_at,
|
|
@@ -46,6 +50,8 @@ module Retab
|
|
|
46
50
|
@n_consensus = hash[:n_consensus]
|
|
47
51
|
@allow_overlap = hash[:allow_overlap].nil? ? true : hash[:allow_overlap]
|
|
48
52
|
@output = (hash[:output] || []).map { |item| item ? Retab::PartitionChunk.new(item) : nil }
|
|
53
|
+
@status = hash[:status].nil? ? "pending" : hash[:status]
|
|
54
|
+
@error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil
|
|
49
55
|
@consensus = hash[:consensus] ? Retab::PartitionConsensus.new(hash[:consensus]) : nil
|
|
50
56
|
@usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
|
|
51
57
|
@created_at = hash[:created_at]
|