|
17 | 17 | max_retries: 80 |
18 | 18 | ) |
19 | 19 |
|
20 | | - params = Mindee::Input::InferenceParameters.new( |
| 20 | + inference_params = Mindee::Input::InferenceParameters.new( |
21 | 21 | model_id, |
22 | 22 | rag: false, |
23 | 23 | raw_text: true, |
|
27 | 27 | polling_options: polling |
28 | 28 | ) |
29 | 29 |
|
30 | | - response = client.enqueue_and_get_inference(input, params) |
| 30 | + response = client.enqueue_and_get_inference(input, inference_params) |
31 | 31 |
|
32 | 32 | expect(response).not_to be_nil |
33 | 33 | expect(response.inference).not_to be_nil |
|
64 | 64 | src_path = File.join(V1_PRODUCT_DATA_DIR, 'financial_document', 'default_sample.jpg') |
65 | 65 | input = Mindee::Input::Source::FileInputSource.new(File.open(src_path, 'rb'), 'default_sample.jpg') |
66 | 66 |
|
67 | | - params = Mindee::Input::InferenceParameters.new( |
| 67 | + inference_params = Mindee::Input::InferenceParameters.new( |
68 | 68 | model_id, |
69 | 69 | raw_text: false, |
70 | 70 | polygon: false, |
|
73 | 73 | file_alias: 'ruby-integration-test' |
74 | 74 | ) |
75 | 75 |
|
76 | | - response = client.enqueue_and_get_inference(input, params) |
| 76 | + response = client.enqueue_and_get_inference(input, inference_params) |
77 | 77 | expect(response).not_to be_nil |
78 | 78 |
|
79 | 79 | file = response.inference.file |
|
111 | 111 | src_path = File.join(FILE_TYPES_DIR, 'pdf', 'blank_1.pdf') |
112 | 112 | input = Mindee::Input::Source::FileInputSource.new(File.open(src_path, 'rb'), 'blank_1.pdf') |
113 | 113 |
|
114 | | - params = Mindee::Input::InferenceParameters.new('INVALID_MODEL_ID') |
| 114 | + inference_params = Mindee::Input::InferenceParameters.new('INVALID_MODEL_ID') |
115 | 115 |
|
116 | 116 | expect do |
117 | | - client.enqueue_inference(input, params) |
| 117 | + client.enqueue_inference(input, inference_params) |
118 | 118 | end.to raise_error(Mindee::Errors::MindeeHTTPErrorV2) { |e| expect(e.status).to eq(422) } |
119 | 119 | end |
120 | 120 |
|
121 | 121 | it 'raises MindeeHTTPErrorV2 (422) on invalid webhook id' do |
122 | 122 | src_path = File.join(FILE_TYPES_DIR, 'pdf', 'blank_1.pdf') |
123 | 123 | input = Mindee::Input::Source::FileInputSource.new(File.open(src_path, 'rb'), 'blank_1.pdf') |
124 | 124 |
|
125 | | - params = Mindee::Input::InferenceParameters.new(model_id, |
126 | | - webhook_ids: ['INVALID_WEBHOOK_ID']) |
| 125 | + params = Mindee::Input::InferenceParameters.new( |
| 126 | + model_id, |
| 127 | + webhook_ids: ['INVALID_WEBHOOK_ID'] |
| 128 | + ) |
127 | 129 |
|
128 | 130 | expect do |
129 | 131 | client.enqueue_inference(input, params) |
|
141 | 143 | src_path = File.join(FILE_TYPES_DIR, 'pdf', 'blank_1.pdf') |
142 | 144 | input = Mindee::Input::Source::FileInputSource.new(File.open(src_path, 'rb'), 'blank_1.pdf') |
143 | 145 |
|
144 | | - params = Mindee::Input::InferenceParameters.new(model_id, |
145 | | - webhook_ids: ['fc405e37-4ba4-4d03-aeba-533a8d1f0f21', |
146 | | - 'fc405e37-4ba4-4d03-aeba-533a8d1f0f21']) |
| 146 | + inference_params = Mindee::Input::InferenceParameters.new( |
| 147 | + model_id, |
| 148 | + webhook_ids: ['fc405e37-4ba4-4d03-aeba-533a8d1f0f21', 'fc405e37-4ba4-4d03-aeba-533a8d1f0f21'] |
| 149 | + ) |
147 | 150 |
|
148 | 151 | expect do |
149 | | - client.enqueue_inference(input, params) |
| 152 | + client.enqueue_inference(input, inference_params) |
150 | 153 | end.to raise_error(Mindee::Errors::MindeeHTTPErrorV2) { |e| |
151 | 154 | expect(e.status).to eq(422) |
152 | 155 | expect(e.code).to start_with('422-') |
|
174 | 177 | it 'raises on invalid model ID' do |
175 | 178 | expect do |
176 | 179 | src_path = File.join(V1_PRODUCT_DATA_DIR, 'financial_document', 'default_sample.jpg') |
177 | | - input = Mindee::Input::Source::FileInputSource.new(File.open(src_path, 'rb'), 'default_sample.jpg') |
| 180 | + input = Mindee::Input::Source::FileInputSource.new( |
| 181 | + File.open(src_path, 'rb'), |
| 182 | + 'default_sample.jpg' |
| 183 | + ) |
178 | 184 |
|
179 | | - params = Mindee::Input::InferenceParameters.new( |
| 185 | + inference_params = Mindee::Input::InferenceParameters.new( |
180 | 186 | 'fc405e37-4ba4-4d03-aeba-533a8d1f0f21', |
181 | 187 | raw_text: false, |
182 | 188 | polygon: false, |
183 | 189 | confidence: false, |
184 | 190 | rag: false, |
185 | 191 | file_alias: 'ruby-integration-test' |
186 | 192 | ) |
187 | | - client.enqueue_and_get_inference(input, params) |
| 193 | + client.enqueue_and_get_inference(input, inference_params) |
188 | 194 | end.to raise_error(Mindee::Errors::MindeeHTTPErrorV2) { |e| |
189 | 195 | expect(e.status).to eq(404) |
190 | 196 | expect(e.code).to start_with('404-') |
|
199 | 205 | it 'parses an URL input source without errors' do |
200 | 206 | url_input = Mindee::Input::Source::URLInputSource.new(blank_pdf_url) |
201 | 207 |
|
202 | | - params = Mindee::Input::InferenceParameters.new(model_id) |
| 208 | + inference_params = Mindee::Input::InferenceParameters.new(model_id) |
203 | 209 |
|
204 | | - response = client.enqueue_and_get_inference(url_input, params) |
| 210 | + response = client.enqueue_and_get_inference(url_input, inference_params) |
205 | 211 |
|
206 | 212 | expect(response).not_to be_nil |
207 | 213 | expect(response.inference).not_to be_nil |
|
0 commit comments