mindee 4.8.0 → 4.9.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/CHANGELOG.md +5 -0
- data/lib/mindee/http/mindee_api_v2.rb +20 -10
- data/lib/mindee/input/inference_parameters.rb +6 -0
- data/lib/mindee/parsing/v2/inference_active_options.rb +3 -0
- data/lib/mindee/version.rb +1 -1
- data/sig/mindee/http/mindee_api_v2.rbs +4 -0
- data/sig/mindee/input/inference_parameters.rbs +2 -0
- data/sig/mindee/input/local_response.rbs +1 -1
- data/sig/mindee/parsing/v2/inference_active_options.rbs +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b3307b74c76a019147939c9d201adcf2d4b2557a9b773475f6b92407ee18f9bf
|
|
4
|
+
data.tar.gz: 4d5f9204fc983bf1e108d1feb04bb3abded3f2d4dad62eba86d714a608af4d48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e712d0f2cdf6926c50513c0bd499beca98de1774067d637a0aeb915071b18d5004ba214d07f6ebb861eb8ac76e56ad5c13e960f209363bcd6ff31459cfdcacb
|
|
7
|
+
data.tar.gz: f9b117e1087b5b89cc3d957fb150c243b2409a0fb40483df6f4279761a4cf1384905c375a973cb3d3c9d95ca7abdca49d6cc8613738ae5ae6a5374464b26e00f
|
data/CHANGELOG.md
CHANGED
|
@@ -111,8 +111,25 @@ module Mindee
|
|
|
111
111
|
poll("#{@settings.base_url}/inferences/#{queue_id}")
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
+
# Handle parameters for the enqueue form
|
|
115
|
+
# @param form_data [Array] Array of form fields
|
|
116
|
+
# @param params [Input::InferenceParameters] Inference options.
|
|
117
|
+
def enqueue_form_options(form_data, params)
|
|
118
|
+
# deal with optional features
|
|
119
|
+
form_data.push(['rag', params.rag.to_s]) unless params.rag.nil?
|
|
120
|
+
form_data.push(['raw_text', params.raw_text.to_s]) unless params.raw_text.nil?
|
|
121
|
+
form_data.push(['polygon', params.polygon.to_s]) unless params.polygon.nil?
|
|
122
|
+
form_data.push(['confidence', params.confidence.to_s]) unless params.confidence.nil?
|
|
123
|
+
form_data.push ['file_alias', params.file_alias] if params.file_alias
|
|
124
|
+
form_data.push ['text_context', params.text_context] if params.text_context
|
|
125
|
+
unless params.webhook_ids.nil? || params.webhook_ids.empty?
|
|
126
|
+
form_data.push ['webhook_ids', params.webhook_ids.join(',')]
|
|
127
|
+
end
|
|
128
|
+
form_data
|
|
129
|
+
end
|
|
130
|
+
|
|
114
131
|
# @param input_source [Mindee::Input::Source::LocalInputSource, Mindee::Input::Source::URLInputSource]
|
|
115
|
-
# @param params [Input::InferenceParameters]
|
|
132
|
+
# @param params [Input::InferenceParameters] Inference options.
|
|
116
133
|
# @return [Net::HTTPResponse, nil]
|
|
117
134
|
def enqueue(input_source, params)
|
|
118
135
|
uri = URI("#{@settings.base_url}/inferences/enqueue")
|
|
@@ -125,16 +142,9 @@ module Mindee
|
|
|
125
142
|
end
|
|
126
143
|
form_data.push(['model_id', params.model_id])
|
|
127
144
|
|
|
128
|
-
# deal with
|
|
129
|
-
form_data
|
|
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?
|
|
145
|
+
# deal with other parameters
|
|
146
|
+
form_data = enqueue_form_options(form_data, params)
|
|
133
147
|
|
|
134
|
-
form_data.push ['file_alias', params.file_alias] if params.file_alias
|
|
135
|
-
unless params.webhook_ids.nil? || params.webhook_ids.empty?
|
|
136
|
-
form_data.push ['webhook_ids', params.webhook_ids.join(',')]
|
|
137
|
-
end
|
|
138
148
|
headers = {
|
|
139
149
|
'Authorization' => @settings.api_key,
|
|
140
150
|
'User-Agent' => @settings.user_agent,
|
|
@@ -25,6 +25,10 @@ module Mindee
|
|
|
25
25
|
# @return [String, nil] Optional alias for the file.
|
|
26
26
|
attr_reader :file_alias
|
|
27
27
|
|
|
28
|
+
# @return [String, nil] Additional text context used by the model during inference.
|
|
29
|
+
# Not recommended, for specific use only.
|
|
30
|
+
attr_reader :text_context
|
|
31
|
+
|
|
28
32
|
# @return [Array<String>, nil] Optional list of Webhooks IDs to propagate the API response to.
|
|
29
33
|
attr_reader :webhook_ids
|
|
30
34
|
|
|
@@ -52,6 +56,7 @@ module Mindee
|
|
|
52
56
|
confidence: nil,
|
|
53
57
|
file_alias: nil,
|
|
54
58
|
webhook_ids: nil,
|
|
59
|
+
text_context: nil,
|
|
55
60
|
polling_options: nil,
|
|
56
61
|
close_file: true
|
|
57
62
|
)
|
|
@@ -64,6 +69,7 @@ module Mindee
|
|
|
64
69
|
@confidence = confidence
|
|
65
70
|
@file_alias = file_alias
|
|
66
71
|
@webhook_ids = webhook_ids || []
|
|
72
|
+
@text_context = text_context
|
|
67
73
|
@polling_options = get_clean_polling_options(polling_options)
|
|
68
74
|
@close_file = close_file.nil? || close_file
|
|
69
75
|
# rubocop:enable Metrics/ParameterLists
|
|
@@ -13,6 +13,8 @@ module Mindee
|
|
|
13
13
|
attr_reader :confidence
|
|
14
14
|
# @return [Boolean] Whether the Retrieval-Augmented Generation feature was activated.
|
|
15
15
|
attr_reader :rag
|
|
16
|
+
# @return [Boolean] Whether the text context feature was activated.
|
|
17
|
+
attr_reader :text_context
|
|
16
18
|
|
|
17
19
|
# @param server_response [Hash] Raw JSON parsed into a Hash.
|
|
18
20
|
def initialize(server_response)
|
|
@@ -20,6 +22,7 @@ module Mindee
|
|
|
20
22
|
@polygon = server_response['polygon']
|
|
21
23
|
@confidence = server_response['confidence']
|
|
22
24
|
@rag = server_response['rag']
|
|
25
|
+
@text_context = server_response['text_context']
|
|
23
26
|
end
|
|
24
27
|
|
|
25
28
|
# String representation.
|
data/lib/mindee/version.rb
CHANGED
|
@@ -13,6 +13,10 @@ module Mindee
|
|
|
13
13
|
def inference_job_req_get: (String) -> Net::HTTPResponse
|
|
14
14
|
def inference_result_req_get: (String) -> Net::HTTPResponse
|
|
15
15
|
def enqueue: (Input::Source::LocalInputSource | Input::Source::URLInputSource, Input::InferenceParameters) -> Net::HTTPResponse?
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def enqueue_form_options: (Array[untyped], Input::InferenceParameters) -> Array[untyped]
|
|
16
20
|
end
|
|
17
21
|
end
|
|
18
22
|
end
|
|
@@ -10,6 +10,7 @@ module Mindee
|
|
|
10
10
|
attr_reader polygon: bool?
|
|
11
11
|
attr_reader rag: bool?
|
|
12
12
|
attr_reader raw_text: bool?
|
|
13
|
+
attr_reader text_context: String?
|
|
13
14
|
attr_reader webhook_ids: Array[String]?
|
|
14
15
|
|
|
15
16
|
def initialize: (
|
|
@@ -19,6 +20,7 @@ module Mindee
|
|
|
19
20
|
?polygon: bool?,
|
|
20
21
|
?confidence: bool?,
|
|
21
22
|
?file_alias: String?,
|
|
23
|
+
?text_context: String?,
|
|
22
24
|
?webhook_ids: Array[String]?,
|
|
23
25
|
?polling_options: Hash[Symbol | String, untyped] | PollingOptions?,
|
|
24
26
|
?close_file: bool?
|
|
@@ -3,7 +3,7 @@ module Mindee
|
|
|
3
3
|
module Input
|
|
4
4
|
class LocalResponse
|
|
5
5
|
def file: -> StringIO
|
|
6
|
-
def initialize: (File | IO | StringIO | String | Pathname) -> void
|
|
6
|
+
def initialize: (File | IO | StringIO | String | Pathname | Tempfile) -> void
|
|
7
7
|
def as_hash: -> Hash[String | Symbol, untyped]
|
|
8
8
|
def self.process_secret_key: (String) -> String
|
|
9
9
|
def get_hmac_signature: (String) -> String
|
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.9.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-
|
|
11
|
+
date: 2025-12-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|