n8n-nodes-pdfvector 0.8.4 → 2.0.4
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.
- package/README.md +69 -233
- package/dist/credentials/PDFVectorApi.credentials.d.ts +1 -0
- package/dist/credentials/PDFVectorApi.credentials.js +19 -6
- package/dist/credentials/PDFVectorApi.credentials.js.map +1 -1
- package/dist/credentials/icon.svg +4 -0
- package/dist/nodes/PdfVector/PdfVector.node.js +61 -1588
- package/dist/nodes/PdfVector/PdfVector.node.js.map +1 -1
- package/dist/nodes/PdfVector/PdfVector.node.json +18 -0
- package/dist/nodes/PdfVector/academic/index.d.ts +3 -0
- package/dist/nodes/PdfVector/academic/index.js +185 -0
- package/dist/nodes/PdfVector/academic/index.js.map +1 -0
- package/dist/nodes/PdfVector/bankStatement/index.d.ts +3 -0
- package/dist/nodes/PdfVector/bankStatement/index.js +31 -0
- package/dist/nodes/PdfVector/bankStatement/index.js.map +1 -0
- package/dist/nodes/PdfVector/document/index.d.ts +3 -0
- package/dist/nodes/PdfVector/document/index.js +31 -0
- package/dist/nodes/PdfVector/document/index.js.map +1 -0
- package/dist/nodes/PdfVector/identity/index.d.ts +3 -0
- package/dist/nodes/PdfVector/identity/index.js +31 -0
- package/dist/nodes/PdfVector/identity/index.js.map +1 -0
- package/dist/nodes/PdfVector/invoice/index.d.ts +3 -0
- package/dist/nodes/PdfVector/invoice/index.js +31 -0
- package/dist/nodes/PdfVector/invoice/index.js.map +1 -0
- package/dist/nodes/PdfVector/shared/api.d.ts +39 -0
- package/dist/nodes/PdfVector/shared/api.js +3 -0
- package/dist/nodes/PdfVector/shared/api.js.map +1 -0
- package/dist/nodes/PdfVector/shared/helpers.d.ts +5 -0
- package/dist/nodes/PdfVector/shared/helpers.js +40 -0
- package/dist/nodes/PdfVector/shared/helpers.js.map +1 -0
- package/dist/nodes/PdfVector/shared/options.d.ts +5 -0
- package/dist/nodes/PdfVector/shared/options.js +159 -0
- package/dist/nodes/PdfVector/shared/options.js.map +1 -0
- package/dist/nodes/PdfVector/shared/pdfvector-api.types.d.ts +988 -0
- package/dist/nodes/PdfVector/shared/pdfvector-api.types.js +3 -0
- package/dist/nodes/PdfVector/shared/pdfvector-api.types.js.map +1 -0
- package/dist/package.json +18 -21
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +61 -64
- package/index.js +0 -0
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PdfVector = void 0;
|
|
4
4
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const index_js_1 = require("./academic/index.js");
|
|
6
|
+
const index_js_2 = require("./bankStatement/index.js");
|
|
7
|
+
const index_js_3 = require("./document/index.js");
|
|
8
|
+
const index_js_4 = require("./identity/index.js");
|
|
9
|
+
const index_js_5 = require("./invoice/index.js");
|
|
5
10
|
class PdfVector {
|
|
6
11
|
constructor() {
|
|
7
12
|
this.description = {
|
|
@@ -9,22 +14,14 @@ class PdfVector {
|
|
|
9
14
|
name: 'pdfVector',
|
|
10
15
|
icon: 'file:icon.svg',
|
|
11
16
|
group: ['transform'],
|
|
12
|
-
|
|
17
|
+
usableAsTool: true,
|
|
18
|
+
version: 2,
|
|
13
19
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
14
20
|
description: 'Convert PDFs, Word, Excel documents, and images to clean markdown, extract structured data with AI, process invoices with specialized parsing, and search millions of academic papers across PubMed, ArXiv, Google Scholar, and more.',
|
|
15
|
-
defaults: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
inputs: ["main"],
|
|
20
|
-
outputs: ["main"],
|
|
21
|
-
credentials: [
|
|
22
|
-
{
|
|
23
|
-
name: 'pdfVectorApi',
|
|
24
|
-
required: true,
|
|
25
|
-
testedBy: 'pdfVectorApiTest',
|
|
26
|
-
},
|
|
27
|
-
],
|
|
21
|
+
defaults: { name: 'PDF Vector' },
|
|
22
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
23
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
24
|
+
credentials: [{ name: 'pdfVectorApi', required: true }],
|
|
28
25
|
properties: [
|
|
29
26
|
{
|
|
30
27
|
displayName: 'Resource',
|
|
@@ -32,1604 +29,80 @@ class PdfVector {
|
|
|
32
29
|
type: 'options',
|
|
33
30
|
noDataExpression: true,
|
|
34
31
|
options: [
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: 'Document',
|
|
41
|
-
value: 'document',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'Identity Document',
|
|
45
|
-
value: 'identityDocument',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'Invoice',
|
|
49
|
-
value: 'invoice',
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
default: 'academic',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
displayName: 'Operation',
|
|
56
|
-
name: 'operation',
|
|
57
|
-
type: 'options',
|
|
58
|
-
noDataExpression: true,
|
|
59
|
-
displayOptions: {
|
|
60
|
-
show: {
|
|
61
|
-
resource: ['academic'],
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
options: [
|
|
65
|
-
{
|
|
66
|
-
name: 'Search',
|
|
67
|
-
value: 'search',
|
|
68
|
-
description: 'Search across PubMed, ArXiv, Google Scholar, and more',
|
|
69
|
-
action: 'Search academic publications',
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
name: 'Fetch',
|
|
73
|
-
value: 'fetch',
|
|
74
|
-
description: 'Fetch publications by DOI, PubMed ID, ArXiv ID, etc',
|
|
75
|
-
action: 'Fetch a specific publication',
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
default: 'search',
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
displayName: 'Operation',
|
|
82
|
-
name: 'operation',
|
|
83
|
-
type: 'options',
|
|
84
|
-
noDataExpression: true,
|
|
85
|
-
displayOptions: {
|
|
86
|
-
show: {
|
|
87
|
-
resource: ['document'],
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
options: [
|
|
91
|
-
{
|
|
92
|
-
name: 'Parse',
|
|
93
|
-
value: 'parse',
|
|
94
|
-
description: 'Convert PDFs, Word, Excel, or images to markdown',
|
|
95
|
-
action: 'Parse a document',
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
name: 'Ask',
|
|
99
|
-
value: 'ask',
|
|
100
|
-
description: 'Ask questions about PDF, Word, Excel, or image',
|
|
101
|
-
action: 'Ask questions about a document',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: 'Extract',
|
|
105
|
-
value: 'extract',
|
|
106
|
-
description: 'Extract structured data from PDF, Word, Excel, or image using JSON Schema',
|
|
107
|
-
action: 'Extract structured data from a document',
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
default: 'parse',
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
displayName: 'Operation',
|
|
114
|
-
name: 'operation',
|
|
115
|
-
type: 'options',
|
|
116
|
-
noDataExpression: true,
|
|
117
|
-
displayOptions: {
|
|
118
|
-
show: {
|
|
119
|
-
resource: ['invoice'],
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
options: [
|
|
123
|
-
{
|
|
124
|
-
name: 'Parse',
|
|
125
|
-
value: 'parse',
|
|
126
|
-
description: 'Parse invoice, expense, bank statement or financial document',
|
|
127
|
-
action: 'Parse an invoice',
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: 'Ask',
|
|
131
|
-
value: 'ask',
|
|
132
|
-
description: 'Ask questions about invoice, expense, bank statement or financial document',
|
|
133
|
-
action: 'Ask questions about an invoice',
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: 'Extract',
|
|
137
|
-
value: 'extract',
|
|
138
|
-
description: 'Extract invoice, expense, bank statement or financial document structured data',
|
|
139
|
-
action: 'Extract structured data from an invoice',
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
default: 'parse',
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
displayName: 'Operation',
|
|
146
|
-
name: 'operation',
|
|
147
|
-
type: 'options',
|
|
148
|
-
noDataExpression: true,
|
|
149
|
-
displayOptions: {
|
|
150
|
-
show: {
|
|
151
|
-
resource: ['identityDocument'],
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
options: [
|
|
155
|
-
{
|
|
156
|
-
name: 'Parse',
|
|
157
|
-
value: 'parse',
|
|
158
|
-
description: 'Parse identity documents (passports, driver licenses, ID cards, national IDs) to markdown',
|
|
159
|
-
action: 'Parse an identity document',
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: 'Ask',
|
|
163
|
-
value: 'ask',
|
|
164
|
-
description: 'Ask questions about identity document content',
|
|
165
|
-
action: 'Ask questions about an identity document',
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
name: 'Extract',
|
|
169
|
-
value: 'extract',
|
|
170
|
-
description: 'Extract structured data from identity documents using JSON Schema',
|
|
171
|
-
action: 'Extract structured data from an identity document',
|
|
172
|
-
},
|
|
173
|
-
],
|
|
174
|
-
default: 'parse',
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
displayName: 'Query',
|
|
178
|
-
name: 'query',
|
|
179
|
-
type: 'string',
|
|
180
|
-
required: true,
|
|
181
|
-
displayOptions: {
|
|
182
|
-
show: {
|
|
183
|
-
resource: ['academic'],
|
|
184
|
-
operation: ['search'],
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
default: '',
|
|
188
|
-
description: 'Search query for academic publications (1-400 characters)',
|
|
189
|
-
placeholder: 'machine learning in healthcare',
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
displayName: 'Providers',
|
|
193
|
-
name: 'providers',
|
|
194
|
-
type: 'multiOptions',
|
|
195
|
-
displayOptions: {
|
|
196
|
-
show: {
|
|
197
|
-
resource: ['academic'],
|
|
198
|
-
operation: ['search'],
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
options: [
|
|
202
|
-
{
|
|
203
|
-
name: 'ArXiv',
|
|
204
|
-
value: 'arxiv',
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
name: 'ERIC',
|
|
208
|
-
value: 'eric',
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
name: 'Europe PMC',
|
|
212
|
-
value: 'europe-pmc',
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
name: 'Google Scholar',
|
|
216
|
-
value: 'google-scholar',
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
name: 'OpenAlex',
|
|
220
|
-
value: 'openalex',
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
name: 'PubMed',
|
|
224
|
-
value: 'pubmed',
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
name: 'Semantic Scholar',
|
|
228
|
-
value: 'semantic-scholar',
|
|
229
|
-
},
|
|
230
|
-
],
|
|
231
|
-
default: ['semantic-scholar'],
|
|
232
|
-
description: 'Academic database providers to search. Select multiple to search across databases.',
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
displayName: 'Limit',
|
|
236
|
-
name: 'limit',
|
|
237
|
-
type: 'number',
|
|
238
|
-
displayOptions: {
|
|
239
|
-
show: {
|
|
240
|
-
resource: ['academic'],
|
|
241
|
-
operation: ['search'],
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
typeOptions: {
|
|
245
|
-
minValue: 1,
|
|
246
|
-
},
|
|
247
|
-
default: 50,
|
|
248
|
-
description: 'Max number of results to return',
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
displayName: 'Offset',
|
|
252
|
-
name: 'offset',
|
|
253
|
-
type: 'number',
|
|
254
|
-
displayOptions: {
|
|
255
|
-
show: {
|
|
256
|
-
resource: ['academic'],
|
|
257
|
-
operation: ['search'],
|
|
258
|
-
},
|
|
259
|
-
},
|
|
260
|
-
typeOptions: {
|
|
261
|
-
minValue: 0,
|
|
262
|
-
},
|
|
263
|
-
default: 0,
|
|
264
|
-
description: 'Number of results to skip per provider',
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
displayName: 'Year From',
|
|
268
|
-
name: 'yearFrom',
|
|
269
|
-
type: 'number',
|
|
270
|
-
displayOptions: {
|
|
271
|
-
show: {
|
|
272
|
-
resource: ['academic'],
|
|
273
|
-
operation: ['search'],
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
|
-
typeOptions: {
|
|
277
|
-
minValue: 1900,
|
|
278
|
-
},
|
|
279
|
-
default: 1900,
|
|
280
|
-
description: 'Filter results published after this year (inclusive)',
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
displayName: 'Year To',
|
|
284
|
-
name: 'yearTo',
|
|
285
|
-
type: 'number',
|
|
286
|
-
displayOptions: {
|
|
287
|
-
show: {
|
|
288
|
-
resource: ['academic'],
|
|
289
|
-
operation: ['search'],
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
typeOptions: {
|
|
293
|
-
maxValue: 2100,
|
|
294
|
-
},
|
|
295
|
-
default: 2050,
|
|
296
|
-
description: 'Filter results published before this year (inclusive)',
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
displayName: 'Additional Fields',
|
|
300
|
-
name: 'additionalFields',
|
|
301
|
-
type: 'collection',
|
|
302
|
-
placeholder: 'Add Field',
|
|
303
|
-
displayOptions: {
|
|
304
|
-
show: {
|
|
305
|
-
resource: ['academic'],
|
|
306
|
-
operation: ['search'],
|
|
307
|
-
},
|
|
308
|
-
},
|
|
309
|
-
default: {},
|
|
310
|
-
options: [
|
|
311
|
-
{
|
|
312
|
-
displayName: 'Fields',
|
|
313
|
-
name: 'fields',
|
|
314
|
-
type: 'multiOptions',
|
|
315
|
-
options: [
|
|
316
|
-
{
|
|
317
|
-
name: 'Abstract',
|
|
318
|
-
value: 'abstract',
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
name: 'Authors',
|
|
322
|
-
value: 'authors',
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
name: 'Date',
|
|
326
|
-
value: 'date',
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
name: 'DOI',
|
|
330
|
-
value: 'doi',
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
name: 'PDF URL',
|
|
334
|
-
value: 'pdfURL',
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
name: 'Provider',
|
|
338
|
-
value: 'provider',
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
name: 'Provider Data',
|
|
342
|
-
value: 'providerData',
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
name: 'Provider URL',
|
|
346
|
-
value: 'providerURL',
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
name: 'Title',
|
|
350
|
-
value: 'title',
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
name: 'Total Citations',
|
|
354
|
-
value: 'totalCitations',
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
name: 'Total References',
|
|
358
|
-
value: 'totalReferences',
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
name: 'URL',
|
|
362
|
-
value: 'url',
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
name: 'Year',
|
|
366
|
-
value: 'year',
|
|
367
|
-
},
|
|
368
|
-
],
|
|
369
|
-
default: [],
|
|
370
|
-
description: 'Fields to include in the response',
|
|
371
|
-
},
|
|
372
|
-
],
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
displayName: 'IDs',
|
|
376
|
-
name: 'ids',
|
|
377
|
-
type: 'string',
|
|
378
|
-
required: true,
|
|
379
|
-
displayOptions: {
|
|
380
|
-
show: {
|
|
381
|
-
resource: ['academic'],
|
|
382
|
-
operation: ['fetch'],
|
|
383
|
-
},
|
|
384
|
-
},
|
|
385
|
-
default: '',
|
|
386
|
-
description: 'Publication IDs with auto-detection. Supports DOI, PubMed ID, ArXiv ID, Semantic Scholar ID, ERIC ID, Europe PMC ID, and OpenAlex ID. Separate multiple IDs with commas (max 100).',
|
|
387
|
-
placeholder: '10.1038/nature12373, PMC3883140, arXiv:1234.5678, ED123456',
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
displayName: 'Fields',
|
|
391
|
-
name: 'fields',
|
|
392
|
-
type: 'multiOptions',
|
|
393
|
-
displayOptions: {
|
|
394
|
-
show: {
|
|
395
|
-
resource: ['academic'],
|
|
396
|
-
operation: ['fetch'],
|
|
397
|
-
},
|
|
398
|
-
},
|
|
399
|
-
options: [
|
|
400
|
-
{
|
|
401
|
-
name: 'Abstract',
|
|
402
|
-
value: 'abstract',
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
name: 'Authors',
|
|
406
|
-
value: 'authors',
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
name: 'Date',
|
|
410
|
-
value: 'date',
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
name: 'DOI',
|
|
414
|
-
value: 'doi',
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
name: 'PDF URL',
|
|
418
|
-
value: 'pdfURL',
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
name: 'Provider',
|
|
422
|
-
value: 'provider',
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
name: 'Provider Data',
|
|
426
|
-
value: 'providerData',
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
name: 'Provider URL',
|
|
430
|
-
value: 'providerURL',
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
name: 'Title',
|
|
434
|
-
value: 'title',
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
name: 'Total Citations',
|
|
438
|
-
value: 'totalCitations',
|
|
439
|
-
},
|
|
440
|
-
{
|
|
441
|
-
name: 'Total References',
|
|
442
|
-
value: 'totalReferences',
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
name: 'URL',
|
|
446
|
-
value: 'url',
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
name: 'Year',
|
|
450
|
-
value: 'year',
|
|
451
|
-
},
|
|
452
|
-
],
|
|
453
|
-
default: [],
|
|
454
|
-
description: 'Fields to include in the response',
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
displayName: 'Input Type',
|
|
458
|
-
name: 'inputType',
|
|
459
|
-
type: 'options',
|
|
460
|
-
displayOptions: {
|
|
461
|
-
show: {
|
|
462
|
-
resource: ['document'],
|
|
463
|
-
operation: ['parse'],
|
|
464
|
-
},
|
|
465
|
-
},
|
|
466
|
-
options: [
|
|
467
|
-
{
|
|
468
|
-
name: 'URL',
|
|
469
|
-
value: 'url',
|
|
470
|
-
description: 'Provide a public URL to the document',
|
|
471
|
-
},
|
|
472
|
-
{
|
|
473
|
-
name: 'File',
|
|
474
|
-
value: 'file',
|
|
475
|
-
description: 'Upload a PDF, Word, Excel, or image file',
|
|
476
|
-
},
|
|
477
|
-
],
|
|
478
|
-
default: 'url',
|
|
479
|
-
description: 'Choose how to provide the document',
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
displayName: 'Document URL',
|
|
483
|
-
name: 'url',
|
|
484
|
-
type: 'string',
|
|
485
|
-
required: true,
|
|
486
|
-
displayOptions: {
|
|
487
|
-
show: {
|
|
488
|
-
resource: ['document'],
|
|
489
|
-
operation: ['parse'],
|
|
490
|
-
inputType: ['url'],
|
|
491
|
-
},
|
|
492
|
-
},
|
|
493
|
-
default: '',
|
|
494
|
-
description: 'URL of the document to parse (PDF, Word, Excel, Image)',
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
displayName: 'Binary Property',
|
|
498
|
-
name: 'binaryPropertyName',
|
|
499
|
-
type: 'string',
|
|
500
|
-
default: 'data',
|
|
501
|
-
required: true,
|
|
502
|
-
displayOptions: {
|
|
503
|
-
show: {
|
|
504
|
-
resource: ['document'],
|
|
505
|
-
operation: ['parse'],
|
|
506
|
-
inputType: ['file'],
|
|
507
|
-
},
|
|
508
|
-
},
|
|
509
|
-
description: 'Name of the binary property containing the file',
|
|
510
|
-
hint: 'The name of the property that holds the binary data from the previous node',
|
|
511
|
-
},
|
|
512
|
-
{
|
|
513
|
-
displayName: 'Use LLM',
|
|
514
|
-
name: 'useLLM',
|
|
515
|
-
type: 'options',
|
|
516
|
-
displayOptions: {
|
|
517
|
-
show: {
|
|
518
|
-
resource: ['document'],
|
|
519
|
-
operation: ['parse'],
|
|
520
|
-
},
|
|
521
|
-
},
|
|
522
|
-
options: [
|
|
523
|
-
{
|
|
524
|
-
name: 'Auto',
|
|
525
|
-
value: 'auto',
|
|
526
|
-
description: 'Automatically decide if LLM parsing is needed (1-2 credits per page)',
|
|
527
|
-
},
|
|
528
|
-
{
|
|
529
|
-
name: 'Always',
|
|
530
|
-
value: 'always',
|
|
531
|
-
description: 'Always use LLM parsing (2 credits per page)',
|
|
532
|
-
},
|
|
533
|
-
{
|
|
534
|
-
name: 'Never',
|
|
535
|
-
value: 'never',
|
|
536
|
-
description: 'Never use LLM parsing (1 credit per page)',
|
|
537
|
-
},
|
|
538
|
-
],
|
|
539
|
-
default: 'auto',
|
|
540
|
-
description: 'Determines LLM parsing approach',
|
|
541
|
-
},
|
|
542
|
-
{
|
|
543
|
-
displayName: 'Input Type',
|
|
544
|
-
name: 'inputType',
|
|
545
|
-
type: 'options',
|
|
546
|
-
displayOptions: {
|
|
547
|
-
show: {
|
|
548
|
-
resource: ['document'],
|
|
549
|
-
operation: ['ask'],
|
|
550
|
-
},
|
|
551
|
-
},
|
|
552
|
-
options: [
|
|
553
|
-
{
|
|
554
|
-
name: 'URL',
|
|
555
|
-
value: 'url',
|
|
556
|
-
description: 'Provide a public URL to the document',
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
name: 'File',
|
|
560
|
-
value: 'file',
|
|
561
|
-
description: 'Upload a PDF, Word, Excel, or image file',
|
|
562
|
-
},
|
|
563
|
-
],
|
|
564
|
-
default: 'url',
|
|
565
|
-
description: 'Choose how to provide the document',
|
|
566
|
-
},
|
|
567
|
-
{
|
|
568
|
-
displayName: 'Document URL',
|
|
569
|
-
name: 'url',
|
|
570
|
-
type: 'string',
|
|
571
|
-
required: true,
|
|
572
|
-
displayOptions: {
|
|
573
|
-
show: {
|
|
574
|
-
resource: ['document'],
|
|
575
|
-
operation: ['ask'],
|
|
576
|
-
inputType: ['url'],
|
|
577
|
-
},
|
|
578
|
-
},
|
|
579
|
-
default: '',
|
|
580
|
-
description: 'URL of the document to ask questions about (PDF, Word, Excel, Image)',
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
displayName: 'Binary Property',
|
|
584
|
-
name: 'binaryPropertyName',
|
|
585
|
-
type: 'string',
|
|
586
|
-
default: 'data',
|
|
587
|
-
required: true,
|
|
588
|
-
displayOptions: {
|
|
589
|
-
show: {
|
|
590
|
-
resource: ['document'],
|
|
591
|
-
operation: ['ask'],
|
|
592
|
-
inputType: ['file'],
|
|
593
|
-
},
|
|
594
|
-
},
|
|
595
|
-
description: 'Name of the binary property containing the file',
|
|
596
|
-
hint: 'The name of the property that holds the binary data from the previous node',
|
|
597
|
-
},
|
|
598
|
-
{
|
|
599
|
-
displayName: 'Prompt',
|
|
600
|
-
name: 'prompt',
|
|
601
|
-
type: 'string',
|
|
602
|
-
required: true,
|
|
603
|
-
displayOptions: {
|
|
604
|
-
show: {
|
|
605
|
-
resource: ['document'],
|
|
606
|
-
operation: ['ask'],
|
|
607
|
-
},
|
|
608
|
-
},
|
|
609
|
-
default: '',
|
|
610
|
-
description: 'Question about the document (1-2000 characters)',
|
|
611
|
-
typeOptions: {
|
|
612
|
-
rows: 4,
|
|
613
|
-
},
|
|
614
|
-
},
|
|
615
|
-
{
|
|
616
|
-
displayName: 'Input Type',
|
|
617
|
-
name: 'inputType',
|
|
618
|
-
type: 'options',
|
|
619
|
-
displayOptions: {
|
|
620
|
-
show: {
|
|
621
|
-
resource: ['document'],
|
|
622
|
-
operation: ['extract'],
|
|
623
|
-
},
|
|
624
|
-
},
|
|
625
|
-
options: [
|
|
626
|
-
{
|
|
627
|
-
name: 'URL',
|
|
628
|
-
value: 'url',
|
|
629
|
-
description: 'Provide a public URL to the document',
|
|
630
|
-
},
|
|
631
|
-
{
|
|
632
|
-
name: 'File',
|
|
633
|
-
value: 'file',
|
|
634
|
-
description: 'Upload a PDF, Word, Excel, or image file',
|
|
635
|
-
},
|
|
636
|
-
],
|
|
637
|
-
default: 'url',
|
|
638
|
-
description: 'Choose how to provide the document',
|
|
639
|
-
},
|
|
640
|
-
{
|
|
641
|
-
displayName: 'Document URL',
|
|
642
|
-
name: 'url',
|
|
643
|
-
type: 'string',
|
|
644
|
-
required: true,
|
|
645
|
-
displayOptions: {
|
|
646
|
-
show: {
|
|
647
|
-
resource: ['document'],
|
|
648
|
-
operation: ['extract'],
|
|
649
|
-
inputType: ['url'],
|
|
650
|
-
},
|
|
651
|
-
},
|
|
652
|
-
default: '',
|
|
653
|
-
description: 'URL of the document to extract data from (PDF, Word, Excel, Image)',
|
|
654
|
-
},
|
|
655
|
-
{
|
|
656
|
-
displayName: 'Binary Property',
|
|
657
|
-
name: 'binaryPropertyName',
|
|
658
|
-
type: 'string',
|
|
659
|
-
default: 'data',
|
|
660
|
-
required: true,
|
|
661
|
-
displayOptions: {
|
|
662
|
-
show: {
|
|
663
|
-
resource: ['document'],
|
|
664
|
-
operation: ['extract'],
|
|
665
|
-
inputType: ['file'],
|
|
666
|
-
},
|
|
667
|
-
},
|
|
668
|
-
description: 'Name of the binary property containing the file',
|
|
669
|
-
hint: 'The name of the property that holds the binary data from the previous node',
|
|
670
|
-
},
|
|
671
|
-
{
|
|
672
|
-
displayName: 'Prompt',
|
|
673
|
-
name: 'prompt',
|
|
674
|
-
type: 'string',
|
|
675
|
-
required: true,
|
|
676
|
-
displayOptions: {
|
|
677
|
-
show: {
|
|
678
|
-
resource: ['document'],
|
|
679
|
-
operation: ['extract'],
|
|
680
|
-
},
|
|
681
|
-
},
|
|
682
|
-
default: '',
|
|
683
|
-
description: 'Instructions for data extraction (1-2000 characters)',
|
|
684
|
-
typeOptions: {
|
|
685
|
-
rows: 4,
|
|
686
|
-
},
|
|
687
|
-
placeholder: 'Extract all invoice details including line items, totals, and dates',
|
|
688
|
-
},
|
|
689
|
-
{
|
|
690
|
-
displayName: 'JSON Schema',
|
|
691
|
-
name: 'schema',
|
|
692
|
-
type: 'json',
|
|
693
|
-
required: true,
|
|
694
|
-
displayOptions: {
|
|
695
|
-
show: {
|
|
696
|
-
resource: ['document'],
|
|
697
|
-
operation: ['extract'],
|
|
698
|
-
},
|
|
699
|
-
},
|
|
700
|
-
default: '{\n "type": "object",\n "properties": {\n "invoiceNumber": { "type": "string" },\n "date": { "type": "string" },\n "total": { "type": "number" },\n "items": {\n "type": "array",\n "items": {\n "type": "object",\n "properties": {\n "description": { "type": "string" },\n "quantity": { "type": "number" },\n "price": { "type": "number" }\n }\n }\n }\n },\n "required": ["invoiceNumber"],\n "additionalProperties": false\n}',
|
|
701
|
-
description: 'JSON schema that defines the structure of data to extract',
|
|
702
|
-
typeOptions: {
|
|
703
|
-
rows: 10,
|
|
704
|
-
},
|
|
705
|
-
hint: 'Use our free [JSON Schema Editor](https://www.pdfvector.com/json-schema-editor) to create and validate your schema.',
|
|
706
|
-
},
|
|
707
|
-
{
|
|
708
|
-
displayName: 'Input Type',
|
|
709
|
-
name: 'inputType',
|
|
710
|
-
type: 'options',
|
|
711
|
-
displayOptions: {
|
|
712
|
-
show: {
|
|
713
|
-
resource: ['invoice'],
|
|
714
|
-
operation: ['parse'],
|
|
715
|
-
},
|
|
716
|
-
},
|
|
717
|
-
options: [
|
|
718
|
-
{
|
|
719
|
-
name: 'URL',
|
|
720
|
-
value: 'url',
|
|
721
|
-
description: 'Provide a public URL to the invoice, expense, bank statement or financial document',
|
|
722
|
-
},
|
|
723
|
-
{
|
|
724
|
-
name: 'File',
|
|
725
|
-
value: 'file',
|
|
726
|
-
description: 'Upload an invoice, expense, bank statement or financial document file',
|
|
727
|
-
},
|
|
728
|
-
],
|
|
729
|
-
default: 'url',
|
|
730
|
-
description: 'Choose how to provide the invoice',
|
|
731
|
-
},
|
|
732
|
-
{
|
|
733
|
-
displayName: 'Invoice URL',
|
|
734
|
-
name: 'url',
|
|
735
|
-
type: 'string',
|
|
736
|
-
required: true,
|
|
737
|
-
displayOptions: {
|
|
738
|
-
show: {
|
|
739
|
-
resource: ['invoice'],
|
|
740
|
-
operation: ['parse'],
|
|
741
|
-
inputType: ['url'],
|
|
742
|
-
},
|
|
743
|
-
},
|
|
744
|
-
default: '',
|
|
745
|
-
description: 'URL of the invoice, expense, bank statement or financial document to parse (PDF, Word, Image)',
|
|
746
|
-
},
|
|
747
|
-
{
|
|
748
|
-
displayName: 'Binary Property',
|
|
749
|
-
name: 'binaryPropertyName',
|
|
750
|
-
type: 'string',
|
|
751
|
-
default: 'data',
|
|
752
|
-
required: true,
|
|
753
|
-
displayOptions: {
|
|
754
|
-
show: {
|
|
755
|
-
resource: ['invoice'],
|
|
756
|
-
operation: ['parse'],
|
|
757
|
-
inputType: ['file'],
|
|
758
|
-
},
|
|
759
|
-
},
|
|
760
|
-
description: 'Name of the binary property containing the invoice file',
|
|
761
|
-
hint: 'The name of the property that holds the binary data from the previous node',
|
|
762
|
-
},
|
|
763
|
-
{
|
|
764
|
-
displayName: 'Input Type',
|
|
765
|
-
name: 'inputType',
|
|
766
|
-
type: 'options',
|
|
767
|
-
displayOptions: {
|
|
768
|
-
show: {
|
|
769
|
-
resource: ['invoice'],
|
|
770
|
-
operation: ['ask'],
|
|
771
|
-
},
|
|
772
|
-
},
|
|
773
|
-
options: [
|
|
774
|
-
{
|
|
775
|
-
name: 'URL',
|
|
776
|
-
value: 'url',
|
|
777
|
-
description: 'Provide a public URL to the invoice, expense, bank statement or financial document',
|
|
778
|
-
},
|
|
779
|
-
{
|
|
780
|
-
name: 'File',
|
|
781
|
-
value: 'file',
|
|
782
|
-
description: 'Upload an invoice, expense, bank statement or financial document file',
|
|
783
|
-
},
|
|
784
|
-
],
|
|
785
|
-
default: 'url',
|
|
786
|
-
description: 'Choose how to provide the invoice',
|
|
787
|
-
},
|
|
788
|
-
{
|
|
789
|
-
displayName: 'Invoice URL',
|
|
790
|
-
name: 'url',
|
|
791
|
-
type: 'string',
|
|
792
|
-
required: true,
|
|
793
|
-
displayOptions: {
|
|
794
|
-
show: {
|
|
795
|
-
resource: ['invoice'],
|
|
796
|
-
operation: ['ask'],
|
|
797
|
-
inputType: ['url'],
|
|
798
|
-
},
|
|
799
|
-
},
|
|
800
|
-
default: '',
|
|
801
|
-
description: 'URL of the invoice, expense, bank statement or financial document to ask questions about (PDF, Word, Image)',
|
|
802
|
-
},
|
|
803
|
-
{
|
|
804
|
-
displayName: 'Binary Property',
|
|
805
|
-
name: 'binaryPropertyName',
|
|
806
|
-
type: 'string',
|
|
807
|
-
default: 'data',
|
|
808
|
-
required: true,
|
|
809
|
-
displayOptions: {
|
|
810
|
-
show: {
|
|
811
|
-
resource: ['invoice'],
|
|
812
|
-
operation: ['ask'],
|
|
813
|
-
inputType: ['file'],
|
|
814
|
-
},
|
|
815
|
-
},
|
|
816
|
-
description: 'Name of the binary property containing the invoice file',
|
|
817
|
-
hint: 'The name of the property that holds the binary data from the previous node',
|
|
818
|
-
},
|
|
819
|
-
{
|
|
820
|
-
displayName: 'Prompt',
|
|
821
|
-
name: 'prompt',
|
|
822
|
-
type: 'string',
|
|
823
|
-
required: true,
|
|
824
|
-
displayOptions: {
|
|
825
|
-
show: {
|
|
826
|
-
resource: ['invoice'],
|
|
827
|
-
operation: ['ask'],
|
|
828
|
-
},
|
|
829
|
-
},
|
|
830
|
-
default: '',
|
|
831
|
-
description: 'Question about the invoice (1-2000 characters)',
|
|
832
|
-
typeOptions: {
|
|
833
|
-
rows: 4,
|
|
834
|
-
},
|
|
835
|
-
placeholder: 'What is the total amount and due date?',
|
|
836
|
-
},
|
|
837
|
-
{
|
|
838
|
-
displayName: 'Input Type',
|
|
839
|
-
name: 'inputType',
|
|
840
|
-
type: 'options',
|
|
841
|
-
displayOptions: {
|
|
842
|
-
show: {
|
|
843
|
-
resource: ['invoice'],
|
|
844
|
-
operation: ['extract'],
|
|
845
|
-
},
|
|
846
|
-
},
|
|
847
|
-
options: [
|
|
848
|
-
{
|
|
849
|
-
name: 'URL',
|
|
850
|
-
value: 'url',
|
|
851
|
-
description: 'Provide a public URL to the invoice, expense, bank statement or financial document',
|
|
852
|
-
},
|
|
853
|
-
{
|
|
854
|
-
name: 'File',
|
|
855
|
-
value: 'file',
|
|
856
|
-
description: 'Upload an invoice, expense, bank statement or financial document file',
|
|
857
|
-
},
|
|
858
|
-
],
|
|
859
|
-
default: 'url',
|
|
860
|
-
description: 'Choose how to provide the invoice',
|
|
861
|
-
},
|
|
862
|
-
{
|
|
863
|
-
displayName: 'Invoice URL',
|
|
864
|
-
name: 'url',
|
|
865
|
-
type: 'string',
|
|
866
|
-
required: true,
|
|
867
|
-
displayOptions: {
|
|
868
|
-
show: {
|
|
869
|
-
resource: ['invoice'],
|
|
870
|
-
operation: ['extract'],
|
|
871
|
-
inputType: ['url'],
|
|
872
|
-
},
|
|
873
|
-
},
|
|
874
|
-
default: '',
|
|
875
|
-
description: 'URL of the invoice, expense, bank statement or financial document to extract data from (PDF, Word, Image)',
|
|
876
|
-
},
|
|
877
|
-
{
|
|
878
|
-
displayName: 'Binary Property',
|
|
879
|
-
name: 'binaryPropertyName',
|
|
880
|
-
type: 'string',
|
|
881
|
-
default: 'data',
|
|
882
|
-
required: true,
|
|
883
|
-
displayOptions: {
|
|
884
|
-
show: {
|
|
885
|
-
resource: ['invoice'],
|
|
886
|
-
operation: ['extract'],
|
|
887
|
-
inputType: ['file'],
|
|
888
|
-
},
|
|
889
|
-
},
|
|
890
|
-
description: 'Name of the binary property containing the invoice file',
|
|
891
|
-
hint: 'The name of the property that holds the binary data from the previous node',
|
|
892
|
-
},
|
|
893
|
-
{
|
|
894
|
-
displayName: 'Prompt',
|
|
895
|
-
name: 'prompt',
|
|
896
|
-
type: 'string',
|
|
897
|
-
required: true,
|
|
898
|
-
displayOptions: {
|
|
899
|
-
show: {
|
|
900
|
-
resource: ['invoice'],
|
|
901
|
-
operation: ['extract'],
|
|
902
|
-
},
|
|
903
|
-
},
|
|
904
|
-
default: '',
|
|
905
|
-
description: 'Instructions for data extraction from the invoice (1-2000 characters)',
|
|
906
|
-
typeOptions: {
|
|
907
|
-
rows: 4,
|
|
908
|
-
},
|
|
909
|
-
placeholder: 'Extract vendor details, line items, totals, taxes, and payment terms',
|
|
910
|
-
},
|
|
911
|
-
{
|
|
912
|
-
displayName: 'JSON Schema',
|
|
913
|
-
name: 'schema',
|
|
914
|
-
type: 'json',
|
|
915
|
-
required: true,
|
|
916
|
-
displayOptions: {
|
|
917
|
-
show: {
|
|
918
|
-
resource: ['invoice'],
|
|
919
|
-
operation: ['extract'],
|
|
920
|
-
},
|
|
921
|
-
},
|
|
922
|
-
default: '{\n "type": "object",\n "properties": {\n "invoiceNumber": { "type": "string" },\n "vendorName": { "type": "string" },\n "date": { "type": "string" },\n "dueDate": { "type": "string" },\n "subtotal": { "type": "number" },\n "tax": { "type": "number" },\n "total": { "type": "number" },\n "lineItems": {\n "type": "array",\n "items": {\n "type": "object",\n "properties": {\n "description": { "type": "string" },\n "quantity": { "type": "number" },\n "unitPrice": { "type": "number" },\n "amount": { "type": "number" }\n }\n }\n }\n },\n "required": ["invoiceNumber", "total"],\n "additionalProperties": false\n}',
|
|
923
|
-
description: 'JSON schema that defines the structure of invoice data to extract',
|
|
924
|
-
typeOptions: {
|
|
925
|
-
rows: 10,
|
|
926
|
-
},
|
|
927
|
-
hint: 'Use our free [JSON Schema Editor](https://www.pdfvector.com/json-schema-editor) to create and validate your schema.',
|
|
928
|
-
},
|
|
929
|
-
{
|
|
930
|
-
displayName: 'Input Type',
|
|
931
|
-
name: 'inputType',
|
|
932
|
-
type: 'options',
|
|
933
|
-
displayOptions: {
|
|
934
|
-
show: {
|
|
935
|
-
resource: ['identityDocument'],
|
|
936
|
-
operation: ['parse'],
|
|
937
|
-
},
|
|
938
|
-
},
|
|
939
|
-
options: [
|
|
940
|
-
{
|
|
941
|
-
name: 'URL',
|
|
942
|
-
value: 'url',
|
|
943
|
-
description: 'Provide a public URL to the identity document',
|
|
944
|
-
},
|
|
945
|
-
{
|
|
946
|
-
name: 'File',
|
|
947
|
-
value: 'file',
|
|
948
|
-
description: 'Upload a PDF or image file of the identity document',
|
|
949
|
-
},
|
|
32
|
+
{ name: 'Academic', value: 'academic' },
|
|
33
|
+
{ name: 'Bank Statement', value: 'bankStatement' },
|
|
34
|
+
{ name: 'Document', value: 'document' },
|
|
35
|
+
{ name: 'Identity Document', value: 'identity' },
|
|
36
|
+
{ name: 'Invoice', value: 'invoice' },
|
|
950
37
|
],
|
|
951
|
-
default: '
|
|
952
|
-
description: 'Choose how to provide the identity document',
|
|
953
|
-
},
|
|
954
|
-
{
|
|
955
|
-
displayName: 'Identity Document URL',
|
|
956
|
-
name: 'url',
|
|
957
|
-
type: 'string',
|
|
958
|
-
required: true,
|
|
959
|
-
displayOptions: {
|
|
960
|
-
show: {
|
|
961
|
-
resource: ['identityDocument'],
|
|
962
|
-
operation: ['parse'],
|
|
963
|
-
inputType: ['url'],
|
|
964
|
-
},
|
|
965
|
-
},
|
|
966
|
-
default: '',
|
|
967
|
-
description: 'URL of the identity document to parse (passport, driver license, ID card, national ID)',
|
|
968
|
-
},
|
|
969
|
-
{
|
|
970
|
-
displayName: 'Binary Property',
|
|
971
|
-
name: 'binaryPropertyName',
|
|
972
|
-
type: 'string',
|
|
973
|
-
default: 'data',
|
|
974
|
-
required: true,
|
|
975
|
-
displayOptions: {
|
|
976
|
-
show: {
|
|
977
|
-
resource: ['identityDocument'],
|
|
978
|
-
operation: ['parse'],
|
|
979
|
-
inputType: ['file'],
|
|
980
|
-
},
|
|
981
|
-
},
|
|
982
|
-
description: 'Name of the binary property containing the identity document file',
|
|
983
|
-
hint: 'The name of the property that holds the binary data from the previous node',
|
|
984
|
-
},
|
|
985
|
-
{
|
|
986
|
-
displayName: 'Input Type',
|
|
987
|
-
name: 'inputType',
|
|
988
|
-
type: 'options',
|
|
989
|
-
displayOptions: {
|
|
990
|
-
show: {
|
|
991
|
-
resource: ['identityDocument'],
|
|
992
|
-
operation: ['ask'],
|
|
993
|
-
},
|
|
994
|
-
},
|
|
995
|
-
options: [
|
|
996
|
-
{
|
|
997
|
-
name: 'URL',
|
|
998
|
-
value: 'url',
|
|
999
|
-
description: 'Provide a public URL to the identity document',
|
|
1000
|
-
},
|
|
1001
|
-
{
|
|
1002
|
-
name: 'File',
|
|
1003
|
-
value: 'file',
|
|
1004
|
-
description: 'Upload a PDF or image file of the identity document',
|
|
1005
|
-
},
|
|
1006
|
-
],
|
|
1007
|
-
default: 'url',
|
|
1008
|
-
description: 'Choose how to provide the identity document',
|
|
1009
|
-
},
|
|
1010
|
-
{
|
|
1011
|
-
displayName: 'Identity Document URL',
|
|
1012
|
-
name: 'url',
|
|
1013
|
-
type: 'string',
|
|
1014
|
-
required: true,
|
|
1015
|
-
displayOptions: {
|
|
1016
|
-
show: {
|
|
1017
|
-
resource: ['identityDocument'],
|
|
1018
|
-
operation: ['ask'],
|
|
1019
|
-
inputType: ['url'],
|
|
1020
|
-
},
|
|
1021
|
-
},
|
|
1022
|
-
default: '',
|
|
1023
|
-
description: 'URL of the identity document to ask questions about (passport, driver license, ID card, national ID)',
|
|
1024
|
-
},
|
|
1025
|
-
{
|
|
1026
|
-
displayName: 'Binary Property',
|
|
1027
|
-
name: 'binaryPropertyName',
|
|
1028
|
-
type: 'string',
|
|
1029
|
-
default: 'data',
|
|
1030
|
-
required: true,
|
|
1031
|
-
displayOptions: {
|
|
1032
|
-
show: {
|
|
1033
|
-
resource: ['identityDocument'],
|
|
1034
|
-
operation: ['ask'],
|
|
1035
|
-
inputType: ['file'],
|
|
1036
|
-
},
|
|
1037
|
-
},
|
|
1038
|
-
description: 'Name of the binary property containing the identity document file',
|
|
1039
|
-
hint: 'The name of the property that holds the binary data from the previous node',
|
|
1040
|
-
},
|
|
1041
|
-
{
|
|
1042
|
-
displayName: 'Prompt',
|
|
1043
|
-
name: 'prompt',
|
|
1044
|
-
type: 'string',
|
|
1045
|
-
required: true,
|
|
1046
|
-
displayOptions: {
|
|
1047
|
-
show: {
|
|
1048
|
-
resource: ['identityDocument'],
|
|
1049
|
-
operation: ['ask'],
|
|
1050
|
-
},
|
|
1051
|
-
},
|
|
1052
|
-
default: '',
|
|
1053
|
-
description: 'Question about the identity document (1-2000 characters)',
|
|
1054
|
-
typeOptions: {
|
|
1055
|
-
rows: 4,
|
|
1056
|
-
},
|
|
1057
|
-
placeholder: 'What is the full name, date of birth, and expiry date on this ID?',
|
|
1058
|
-
},
|
|
1059
|
-
{
|
|
1060
|
-
displayName: 'Input Type',
|
|
1061
|
-
name: 'inputType',
|
|
1062
|
-
type: 'options',
|
|
1063
|
-
displayOptions: {
|
|
1064
|
-
show: {
|
|
1065
|
-
resource: ['identityDocument'],
|
|
1066
|
-
operation: ['extract'],
|
|
1067
|
-
},
|
|
1068
|
-
},
|
|
1069
|
-
options: [
|
|
1070
|
-
{
|
|
1071
|
-
name: 'URL',
|
|
1072
|
-
value: 'url',
|
|
1073
|
-
description: 'Provide a public URL to the identity document',
|
|
1074
|
-
},
|
|
1075
|
-
{
|
|
1076
|
-
name: 'File',
|
|
1077
|
-
value: 'file',
|
|
1078
|
-
description: 'Upload a PDF or image file of the identity document',
|
|
1079
|
-
},
|
|
1080
|
-
],
|
|
1081
|
-
default: 'url',
|
|
1082
|
-
description: 'Choose how to provide the identity document',
|
|
1083
|
-
},
|
|
1084
|
-
{
|
|
1085
|
-
displayName: 'Identity Document URL',
|
|
1086
|
-
name: 'url',
|
|
1087
|
-
type: 'string',
|
|
1088
|
-
required: true,
|
|
1089
|
-
displayOptions: {
|
|
1090
|
-
show: {
|
|
1091
|
-
resource: ['identityDocument'],
|
|
1092
|
-
operation: ['extract'],
|
|
1093
|
-
inputType: ['url'],
|
|
1094
|
-
},
|
|
1095
|
-
},
|
|
1096
|
-
default: '',
|
|
1097
|
-
description: 'URL of the identity document to extract data from (passport, driver license, ID card, national ID)',
|
|
1098
|
-
},
|
|
1099
|
-
{
|
|
1100
|
-
displayName: 'Binary Property',
|
|
1101
|
-
name: 'binaryPropertyName',
|
|
1102
|
-
type: 'string',
|
|
1103
|
-
default: 'data',
|
|
1104
|
-
required: true,
|
|
1105
|
-
displayOptions: {
|
|
1106
|
-
show: {
|
|
1107
|
-
resource: ['identityDocument'],
|
|
1108
|
-
operation: ['extract'],
|
|
1109
|
-
inputType: ['file'],
|
|
1110
|
-
},
|
|
1111
|
-
},
|
|
1112
|
-
description: 'Name of the binary property containing the identity document file',
|
|
1113
|
-
hint: 'The name of the property that holds the binary data from the previous node',
|
|
1114
|
-
},
|
|
1115
|
-
{
|
|
1116
|
-
displayName: 'Prompt',
|
|
1117
|
-
name: 'prompt',
|
|
1118
|
-
type: 'string',
|
|
1119
|
-
required: true,
|
|
1120
|
-
displayOptions: {
|
|
1121
|
-
show: {
|
|
1122
|
-
resource: ['identityDocument'],
|
|
1123
|
-
operation: ['extract'],
|
|
1124
|
-
},
|
|
1125
|
-
},
|
|
1126
|
-
default: '',
|
|
1127
|
-
description: 'Instructions for data extraction from the identity document (1-2000 characters)',
|
|
1128
|
-
typeOptions: {
|
|
1129
|
-
rows: 4,
|
|
1130
|
-
},
|
|
1131
|
-
placeholder: 'Extract all personal and document information from this identity document',
|
|
1132
|
-
},
|
|
1133
|
-
{
|
|
1134
|
-
displayName: 'JSON Schema',
|
|
1135
|
-
name: 'schema',
|
|
1136
|
-
type: 'json',
|
|
1137
|
-
required: true,
|
|
1138
|
-
displayOptions: {
|
|
1139
|
-
show: {
|
|
1140
|
-
resource: ['identityDocument'],
|
|
1141
|
-
operation: ['extract'],
|
|
1142
|
-
},
|
|
1143
|
-
},
|
|
1144
|
-
default: '{\n "type": "object",\n "properties": {\n "documentType": { "type": "string" },\n "documentNumber": { "type": "string" },\n "issuingCountry": { "type": "string" },\n "fullName": { "type": "string" },\n "firstName": { "type": "string" },\n "lastName": { "type": "string" },\n "dateOfBirth": { "type": "string" },\n "gender": { "type": "string" },\n "nationality": { "type": "string" },\n "address": { "type": "string" },\n "issueDate": { "type": "string" },\n "expiryDate": { "type": "string" }\n },\n "required": ["documentType", "documentNumber", "fullName"],\n "additionalProperties": false\n}',
|
|
1145
|
-
description: 'JSON schema that defines the structure of identity document data to extract',
|
|
1146
|
-
typeOptions: {
|
|
1147
|
-
rows: 10,
|
|
1148
|
-
},
|
|
1149
|
-
hint: 'Use our free [JSON Schema Editor](https://www.pdfvector.com/json-schema-editor) to create and validate your schema.',
|
|
38
|
+
default: 'document',
|
|
1150
39
|
},
|
|
40
|
+
...index_js_3.documentProperties,
|
|
41
|
+
...index_js_4.identityProperties,
|
|
42
|
+
...index_js_5.invoiceProperties,
|
|
43
|
+
...index_js_2.bankStatementProperties,
|
|
44
|
+
...index_js_1.academicProperties,
|
|
1151
45
|
],
|
|
1152
46
|
};
|
|
1153
47
|
}
|
|
1154
48
|
async execute() {
|
|
1155
|
-
var _a
|
|
49
|
+
var _a;
|
|
1156
50
|
const items = this.getInputData();
|
|
1157
51
|
const returnData = [];
|
|
52
|
+
const credentials = await this.getCredentials('pdfVectorApi');
|
|
53
|
+
const domain = credentials.domain || 'global.pdfvector.com';
|
|
1158
54
|
const resource = this.getNodeParameter('resource', 0);
|
|
1159
55
|
const operation = this.getNodeParameter('operation', 0);
|
|
1160
56
|
for (let i = 0; i < items.length; i++) {
|
|
1161
57
|
try {
|
|
1162
|
-
let
|
|
1163
|
-
const baseURL = 'https://www.pdfvector.com/v1/api';
|
|
58
|
+
let result = {};
|
|
1164
59
|
switch (resource) {
|
|
1165
|
-
case '
|
|
1166
|
-
|
|
1167
|
-
const query = this.getNodeParameter('query', i);
|
|
1168
|
-
const providers = this.getNodeParameter('providers', i);
|
|
1169
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1170
|
-
const offset = this.getNodeParameter('offset', i);
|
|
1171
|
-
const yearFrom = this.getNodeParameter('yearFrom', i);
|
|
1172
|
-
const yearTo = this.getNodeParameter('yearTo', i);
|
|
1173
|
-
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1174
|
-
const body = {
|
|
1175
|
-
query,
|
|
1176
|
-
providers,
|
|
1177
|
-
limit,
|
|
1178
|
-
offset,
|
|
1179
|
-
yearFrom,
|
|
1180
|
-
yearTo,
|
|
1181
|
-
};
|
|
1182
|
-
if (additionalFields.fields &&
|
|
1183
|
-
Array.isArray(additionalFields.fields) &&
|
|
1184
|
-
additionalFields.fields.length > 0)
|
|
1185
|
-
body.fields = additionalFields.fields;
|
|
1186
|
-
responseData = (await this.helpers.httpRequestWithAuthentication.call(this, 'pdfVectorApi', {
|
|
1187
|
-
method: 'POST',
|
|
1188
|
-
url: `${baseURL}/academic-search`,
|
|
1189
|
-
body,
|
|
1190
|
-
json: true,
|
|
1191
|
-
}));
|
|
1192
|
-
}
|
|
1193
|
-
else if (operation === 'fetch') {
|
|
1194
|
-
const idsString = this.getNodeParameter('ids', i);
|
|
1195
|
-
const fields = this.getNodeParameter('fields', i);
|
|
1196
|
-
const ids = String(idsString)
|
|
1197
|
-
.split(',')
|
|
1198
|
-
.map((id) => id.trim())
|
|
1199
|
-
.filter(Boolean);
|
|
1200
|
-
const body = {
|
|
1201
|
-
ids,
|
|
1202
|
-
};
|
|
1203
|
-
if (fields.length > 0)
|
|
1204
|
-
body.fields = fields;
|
|
1205
|
-
responseData = (await this.helpers.httpRequestWithAuthentication.call(this, 'pdfVectorApi', {
|
|
1206
|
-
method: 'POST',
|
|
1207
|
-
url: `${baseURL}/academic-fetch`,
|
|
1208
|
-
body,
|
|
1209
|
-
json: true,
|
|
1210
|
-
}));
|
|
1211
|
-
}
|
|
60
|
+
case 'document':
|
|
61
|
+
result = await (0, index_js_3.executeDocument)(this, domain, operation, i);
|
|
1212
62
|
break;
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
if (operation === 'parse') {
|
|
1216
|
-
const inputType = this.getNodeParameter('inputType', i);
|
|
1217
|
-
const useLLM = this.getNodeParameter('useLLM', i);
|
|
1218
|
-
const body = {};
|
|
1219
|
-
body.useLLM = useLLM;
|
|
1220
|
-
if (inputType === 'file') {
|
|
1221
|
-
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
|
1222
|
-
if (!((_a = items[i].binary) === null || _a === void 0 ? void 0 : _a[binaryPropertyName])) {
|
|
1223
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data found in property "${binaryPropertyName}"`, { itemIndex: i });
|
|
1224
|
-
}
|
|
1225
|
-
const binaryData = items[i].binary[binaryPropertyName];
|
|
1226
|
-
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
1227
|
-
if (!buffer || buffer.length === 0) {
|
|
1228
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Binary data in property "${binaryPropertyName}" is empty or invalid`, { itemIndex: i });
|
|
1229
|
-
}
|
|
1230
|
-
const base64File = buffer.toString('base64');
|
|
1231
|
-
body.file = base64File;
|
|
1232
|
-
if (binaryData.fileName) {
|
|
1233
|
-
body.fileName = binaryData.fileName;
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
else if (inputType === 'url') {
|
|
1237
|
-
const documentUrl = this.getNodeParameter('url', i);
|
|
1238
|
-
body.url = documentUrl;
|
|
1239
|
-
}
|
|
1240
|
-
else {
|
|
1241
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid input type: ${inputType}. Must be either 'file' or 'url'`, { itemIndex: i });
|
|
1242
|
-
}
|
|
1243
|
-
responseData = (await this.helpers.httpRequestWithAuthentication.call(this, 'pdfVectorApi', {
|
|
1244
|
-
method: 'POST',
|
|
1245
|
-
url: `${baseURL}/parse`,
|
|
1246
|
-
body,
|
|
1247
|
-
json: true,
|
|
1248
|
-
}));
|
|
1249
|
-
}
|
|
1250
|
-
else if (operation === 'ask') {
|
|
1251
|
-
const inputType = this.getNodeParameter('inputType', i);
|
|
1252
|
-
const prompt = this.getNodeParameter('prompt', i);
|
|
1253
|
-
const body = {};
|
|
1254
|
-
body.prompt = prompt;
|
|
1255
|
-
if (inputType === 'file') {
|
|
1256
|
-
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
|
1257
|
-
if (!((_b = items[i].binary) === null || _b === void 0 ? void 0 : _b[binaryPropertyName])) {
|
|
1258
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data found in property "${binaryPropertyName}"`, { itemIndex: i });
|
|
1259
|
-
}
|
|
1260
|
-
const binaryData = items[i].binary[binaryPropertyName];
|
|
1261
|
-
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
1262
|
-
if (!buffer || buffer.length === 0) {
|
|
1263
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Binary data in property "${binaryPropertyName}" is empty or invalid`, { itemIndex: i });
|
|
1264
|
-
}
|
|
1265
|
-
const base64File = buffer.toString('base64');
|
|
1266
|
-
body.file = base64File;
|
|
1267
|
-
if (binaryData.fileName) {
|
|
1268
|
-
body.fileName = binaryData.fileName;
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
else if (inputType === 'url') {
|
|
1272
|
-
const documentUrl = this.getNodeParameter('url', i);
|
|
1273
|
-
body.url = documentUrl;
|
|
1274
|
-
}
|
|
1275
|
-
else {
|
|
1276
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid input type: ${inputType}. Must be either 'file' or 'url'`, { itemIndex: i });
|
|
1277
|
-
}
|
|
1278
|
-
responseData = (await this.helpers.httpRequestWithAuthentication.call(this, 'pdfVectorApi', {
|
|
1279
|
-
method: 'POST',
|
|
1280
|
-
url: `${baseURL}/ask`,
|
|
1281
|
-
body,
|
|
1282
|
-
json: true,
|
|
1283
|
-
}));
|
|
1284
|
-
}
|
|
1285
|
-
else if (operation === 'extract') {
|
|
1286
|
-
const inputType = this.getNodeParameter('inputType', i);
|
|
1287
|
-
const prompt = this.getNodeParameter('prompt', i);
|
|
1288
|
-
const schemaString = this.getNodeParameter('schema', i);
|
|
1289
|
-
const body = {};
|
|
1290
|
-
body.prompt = prompt;
|
|
1291
|
-
try {
|
|
1292
|
-
const schema = JSON.parse(schemaString);
|
|
1293
|
-
if (schema.type !== 'object') {
|
|
1294
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Schema must have type "object"', {
|
|
1295
|
-
itemIndex: i,
|
|
1296
|
-
});
|
|
1297
|
-
}
|
|
1298
|
-
if (schema.additionalProperties !== false) {
|
|
1299
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Schema must include "additionalProperties": false', { itemIndex: i });
|
|
1300
|
-
}
|
|
1301
|
-
body.schema = schema;
|
|
1302
|
-
}
|
|
1303
|
-
catch (error) {
|
|
1304
|
-
if (error instanceof n8n_workflow_1.NodeOperationError) {
|
|
1305
|
-
throw error;
|
|
1306
|
-
}
|
|
1307
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid JSON schema: ${error.message}`, { itemIndex: i });
|
|
1308
|
-
}
|
|
1309
|
-
if (inputType === 'file') {
|
|
1310
|
-
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
|
1311
|
-
if (!((_c = items[i].binary) === null || _c === void 0 ? void 0 : _c[binaryPropertyName])) {
|
|
1312
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data found in property "${binaryPropertyName}"`, { itemIndex: i });
|
|
1313
|
-
}
|
|
1314
|
-
const binaryData = items[i].binary[binaryPropertyName];
|
|
1315
|
-
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
1316
|
-
if (!buffer || buffer.length === 0) {
|
|
1317
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Binary data in property "${binaryPropertyName}" is empty or invalid`, { itemIndex: i });
|
|
1318
|
-
}
|
|
1319
|
-
const base64File = buffer.toString('base64');
|
|
1320
|
-
body.file = base64File;
|
|
1321
|
-
if (binaryData.fileName) {
|
|
1322
|
-
body.fileName = binaryData.fileName;
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
else if (inputType === 'url') {
|
|
1326
|
-
const documentUrl = this.getNodeParameter('url', i);
|
|
1327
|
-
body.url = documentUrl;
|
|
1328
|
-
}
|
|
1329
|
-
else {
|
|
1330
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid input type: ${inputType}. Must be either 'file' or 'url'`, { itemIndex: i });
|
|
1331
|
-
}
|
|
1332
|
-
responseData = (await this.helpers.httpRequestWithAuthentication.call(this, 'pdfVectorApi', {
|
|
1333
|
-
method: 'POST',
|
|
1334
|
-
url: `${baseURL}/extract`,
|
|
1335
|
-
body,
|
|
1336
|
-
json: true,
|
|
1337
|
-
}));
|
|
1338
|
-
}
|
|
63
|
+
case 'identity':
|
|
64
|
+
result = await (0, index_js_4.executeIdentity)(this, domain, operation, i);
|
|
1339
65
|
break;
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
if (operation === 'parse') {
|
|
1343
|
-
const inputType = this.getNodeParameter('inputType', i);
|
|
1344
|
-
const body = {};
|
|
1345
|
-
if (inputType === 'file') {
|
|
1346
|
-
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
|
1347
|
-
if (!((_d = items[i].binary) === null || _d === void 0 ? void 0 : _d[binaryPropertyName])) {
|
|
1348
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data found in property "${binaryPropertyName}"`, { itemIndex: i });
|
|
1349
|
-
}
|
|
1350
|
-
const binaryData = items[i].binary[binaryPropertyName];
|
|
1351
|
-
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
1352
|
-
if (!buffer || buffer.length === 0) {
|
|
1353
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Binary data in property "${binaryPropertyName}" is empty or invalid`, { itemIndex: i });
|
|
1354
|
-
}
|
|
1355
|
-
const base64File = buffer.toString('base64');
|
|
1356
|
-
body.file = base64File;
|
|
1357
|
-
if (binaryData.fileName) {
|
|
1358
|
-
body.fileName = binaryData.fileName;
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
else if (inputType === 'url') {
|
|
1362
|
-
const invoiceUrl = this.getNodeParameter('url', i);
|
|
1363
|
-
body.url = invoiceUrl;
|
|
1364
|
-
}
|
|
1365
|
-
else {
|
|
1366
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid input type: ${inputType}. Must be either 'file' or 'url'`, { itemIndex: i });
|
|
1367
|
-
}
|
|
1368
|
-
responseData = (await this.helpers.httpRequestWithAuthentication.call(this, 'pdfVectorApi', {
|
|
1369
|
-
method: 'POST',
|
|
1370
|
-
url: `${baseURL}/invoice-parse`,
|
|
1371
|
-
body,
|
|
1372
|
-
json: true,
|
|
1373
|
-
}));
|
|
1374
|
-
}
|
|
1375
|
-
else if (operation === 'ask') {
|
|
1376
|
-
const inputType = this.getNodeParameter('inputType', i);
|
|
1377
|
-
const prompt = this.getNodeParameter('prompt', i);
|
|
1378
|
-
const body = {};
|
|
1379
|
-
body.prompt = prompt;
|
|
1380
|
-
if (inputType === 'file') {
|
|
1381
|
-
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
|
1382
|
-
if (!((_e = items[i].binary) === null || _e === void 0 ? void 0 : _e[binaryPropertyName])) {
|
|
1383
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data found in property "${binaryPropertyName}"`, { itemIndex: i });
|
|
1384
|
-
}
|
|
1385
|
-
const binaryData = items[i].binary[binaryPropertyName];
|
|
1386
|
-
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
1387
|
-
if (!buffer || buffer.length === 0) {
|
|
1388
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Binary data in property "${binaryPropertyName}" is empty or invalid`, { itemIndex: i });
|
|
1389
|
-
}
|
|
1390
|
-
const base64File = buffer.toString('base64');
|
|
1391
|
-
body.file = base64File;
|
|
1392
|
-
if (binaryData.fileName) {
|
|
1393
|
-
body.fileName = binaryData.fileName;
|
|
1394
|
-
}
|
|
1395
|
-
}
|
|
1396
|
-
else if (inputType === 'url') {
|
|
1397
|
-
const invoiceUrl = this.getNodeParameter('url', i);
|
|
1398
|
-
body.url = invoiceUrl;
|
|
1399
|
-
}
|
|
1400
|
-
else {
|
|
1401
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid input type: ${inputType}. Must be either 'file' or 'url'`, { itemIndex: i });
|
|
1402
|
-
}
|
|
1403
|
-
responseData = (await this.helpers.httpRequestWithAuthentication.call(this, 'pdfVectorApi', {
|
|
1404
|
-
method: 'POST',
|
|
1405
|
-
url: `${baseURL}/invoice-ask`,
|
|
1406
|
-
body,
|
|
1407
|
-
json: true,
|
|
1408
|
-
}));
|
|
1409
|
-
}
|
|
1410
|
-
else if (operation === 'extract') {
|
|
1411
|
-
const inputType = this.getNodeParameter('inputType', i);
|
|
1412
|
-
const prompt = this.getNodeParameter('prompt', i);
|
|
1413
|
-
const schemaString = this.getNodeParameter('schema', i);
|
|
1414
|
-
const body = {};
|
|
1415
|
-
body.prompt = prompt;
|
|
1416
|
-
try {
|
|
1417
|
-
const schema = JSON.parse(schemaString);
|
|
1418
|
-
if (schema.type !== 'object') {
|
|
1419
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Schema must have type "object"', {
|
|
1420
|
-
itemIndex: i,
|
|
1421
|
-
});
|
|
1422
|
-
}
|
|
1423
|
-
if (schema.additionalProperties !== false) {
|
|
1424
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Schema must include "additionalProperties": false', { itemIndex: i });
|
|
1425
|
-
}
|
|
1426
|
-
body.schema = schema;
|
|
1427
|
-
}
|
|
1428
|
-
catch (error) {
|
|
1429
|
-
if (error instanceof n8n_workflow_1.NodeOperationError) {
|
|
1430
|
-
throw error;
|
|
1431
|
-
}
|
|
1432
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid JSON schema: ${error.message}`, { itemIndex: i });
|
|
1433
|
-
}
|
|
1434
|
-
if (inputType === 'file') {
|
|
1435
|
-
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
|
1436
|
-
if (!((_f = items[i].binary) === null || _f === void 0 ? void 0 : _f[binaryPropertyName])) {
|
|
1437
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data found in property "${binaryPropertyName}"`, { itemIndex: i });
|
|
1438
|
-
}
|
|
1439
|
-
const binaryData = items[i].binary[binaryPropertyName];
|
|
1440
|
-
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
1441
|
-
if (!buffer || buffer.length === 0) {
|
|
1442
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Binary data in property "${binaryPropertyName}" is empty or invalid`, { itemIndex: i });
|
|
1443
|
-
}
|
|
1444
|
-
const base64File = buffer.toString('base64');
|
|
1445
|
-
body.file = base64File;
|
|
1446
|
-
if (binaryData.fileName) {
|
|
1447
|
-
body.fileName = binaryData.fileName;
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
else if (inputType === 'url') {
|
|
1451
|
-
const invoiceUrl = this.getNodeParameter('url', i);
|
|
1452
|
-
body.url = invoiceUrl;
|
|
1453
|
-
}
|
|
1454
|
-
else {
|
|
1455
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid input type: ${inputType}. Must be either 'file' or 'url'`, { itemIndex: i });
|
|
1456
|
-
}
|
|
1457
|
-
responseData = (await this.helpers.httpRequestWithAuthentication.call(this, 'pdfVectorApi', {
|
|
1458
|
-
method: 'POST',
|
|
1459
|
-
url: `${baseURL}/invoice-extract`,
|
|
1460
|
-
body,
|
|
1461
|
-
json: true,
|
|
1462
|
-
}));
|
|
1463
|
-
}
|
|
66
|
+
case 'invoice':
|
|
67
|
+
result = await (0, index_js_5.executeInvoice)(this, domain, operation, i);
|
|
1464
68
|
break;
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
if (inputType === 'file') {
|
|
1471
|
-
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
|
1472
|
-
if (!((_g = items[i].binary) === null || _g === void 0 ? void 0 : _g[binaryPropertyName])) {
|
|
1473
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data found in property "${binaryPropertyName}"`, { itemIndex: i });
|
|
1474
|
-
}
|
|
1475
|
-
const binaryData = items[i].binary[binaryPropertyName];
|
|
1476
|
-
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
1477
|
-
if (!buffer || buffer.length === 0) {
|
|
1478
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Binary data in property "${binaryPropertyName}" is empty or invalid`, { itemIndex: i });
|
|
1479
|
-
}
|
|
1480
|
-
const base64File = buffer.toString('base64');
|
|
1481
|
-
body.file = base64File;
|
|
1482
|
-
if (binaryData.fileName) {
|
|
1483
|
-
body.fileName = binaryData.fileName;
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
else if (inputType === 'url') {
|
|
1487
|
-
const idDocumentUrl = this.getNodeParameter('url', i);
|
|
1488
|
-
body.url = idDocumentUrl;
|
|
1489
|
-
}
|
|
1490
|
-
else {
|
|
1491
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid input type: ${inputType}. Must be either 'file' or 'url'`, { itemIndex: i });
|
|
1492
|
-
}
|
|
1493
|
-
responseData = (await this.helpers.httpRequestWithAuthentication.call(this, 'pdfVectorApi', {
|
|
1494
|
-
method: 'POST',
|
|
1495
|
-
url: `${baseURL}/id-parse`,
|
|
1496
|
-
body,
|
|
1497
|
-
json: true,
|
|
1498
|
-
}));
|
|
1499
|
-
}
|
|
1500
|
-
else if (operation === 'ask') {
|
|
1501
|
-
const inputType = this.getNodeParameter('inputType', i);
|
|
1502
|
-
const prompt = this.getNodeParameter('prompt', i);
|
|
1503
|
-
const body = {};
|
|
1504
|
-
body.prompt = prompt;
|
|
1505
|
-
if (inputType === 'file') {
|
|
1506
|
-
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
|
1507
|
-
if (!((_h = items[i].binary) === null || _h === void 0 ? void 0 : _h[binaryPropertyName])) {
|
|
1508
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data found in property "${binaryPropertyName}"`, { itemIndex: i });
|
|
1509
|
-
}
|
|
1510
|
-
const binaryData = items[i].binary[binaryPropertyName];
|
|
1511
|
-
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
1512
|
-
if (!buffer || buffer.length === 0) {
|
|
1513
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Binary data in property "${binaryPropertyName}" is empty or invalid`, { itemIndex: i });
|
|
1514
|
-
}
|
|
1515
|
-
const base64File = buffer.toString('base64');
|
|
1516
|
-
body.file = base64File;
|
|
1517
|
-
if (binaryData.fileName) {
|
|
1518
|
-
body.fileName = binaryData.fileName;
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
else if (inputType === 'url') {
|
|
1522
|
-
const idDocumentUrl = this.getNodeParameter('url', i);
|
|
1523
|
-
body.url = idDocumentUrl;
|
|
1524
|
-
}
|
|
1525
|
-
else {
|
|
1526
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid input type: ${inputType}. Must be either 'file' or 'url'`, { itemIndex: i });
|
|
1527
|
-
}
|
|
1528
|
-
responseData = (await this.helpers.httpRequestWithAuthentication.call(this, 'pdfVectorApi', {
|
|
1529
|
-
method: 'POST',
|
|
1530
|
-
url: `${baseURL}/id-ask`,
|
|
1531
|
-
body,
|
|
1532
|
-
json: true,
|
|
1533
|
-
}));
|
|
1534
|
-
}
|
|
1535
|
-
else if (operation === 'extract') {
|
|
1536
|
-
const inputType = this.getNodeParameter('inputType', i);
|
|
1537
|
-
const prompt = this.getNodeParameter('prompt', i);
|
|
1538
|
-
const schemaString = this.getNodeParameter('schema', i);
|
|
1539
|
-
const body = {};
|
|
1540
|
-
body.prompt = prompt;
|
|
1541
|
-
try {
|
|
1542
|
-
const schema = JSON.parse(schemaString);
|
|
1543
|
-
if (schema.type !== 'object') {
|
|
1544
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Schema must have type "object"', {
|
|
1545
|
-
itemIndex: i,
|
|
1546
|
-
});
|
|
1547
|
-
}
|
|
1548
|
-
if (schema.additionalProperties !== false) {
|
|
1549
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Schema must include "additionalProperties": false', { itemIndex: i });
|
|
1550
|
-
}
|
|
1551
|
-
body.schema = schema;
|
|
1552
|
-
}
|
|
1553
|
-
catch (error) {
|
|
1554
|
-
if (error instanceof n8n_workflow_1.NodeOperationError) {
|
|
1555
|
-
throw error;
|
|
1556
|
-
}
|
|
1557
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid JSON schema: ${error.message}`, { itemIndex: i });
|
|
1558
|
-
}
|
|
1559
|
-
if (inputType === 'file') {
|
|
1560
|
-
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
|
1561
|
-
if (!((_j = items[i].binary) === null || _j === void 0 ? void 0 : _j[binaryPropertyName])) {
|
|
1562
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data found in property "${binaryPropertyName}"`, { itemIndex: i });
|
|
1563
|
-
}
|
|
1564
|
-
const binaryData = items[i].binary[binaryPropertyName];
|
|
1565
|
-
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
1566
|
-
if (!buffer || buffer.length === 0) {
|
|
1567
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Binary data in property "${binaryPropertyName}" is empty or invalid`, { itemIndex: i });
|
|
1568
|
-
}
|
|
1569
|
-
const base64File = buffer.toString('base64');
|
|
1570
|
-
body.file = base64File;
|
|
1571
|
-
if (binaryData.fileName) {
|
|
1572
|
-
body.fileName = binaryData.fileName;
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
else if (inputType === 'url') {
|
|
1576
|
-
const idDocumentUrl = this.getNodeParameter('url', i);
|
|
1577
|
-
body.url = idDocumentUrl;
|
|
1578
|
-
}
|
|
1579
|
-
else {
|
|
1580
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid input type: ${inputType}. Must be either 'file' or 'url'`, { itemIndex: i });
|
|
1581
|
-
}
|
|
1582
|
-
responseData = (await this.helpers.httpRequestWithAuthentication.call(this, 'pdfVectorApi', {
|
|
1583
|
-
method: 'POST',
|
|
1584
|
-
url: `${baseURL}/id-extract`,
|
|
1585
|
-
body,
|
|
1586
|
-
json: true,
|
|
1587
|
-
}));
|
|
1588
|
-
}
|
|
69
|
+
case 'bankStatement':
|
|
70
|
+
result = await (0, index_js_2.executeBankStatement)(this, domain, operation, i);
|
|
71
|
+
break;
|
|
72
|
+
case 'academic':
|
|
73
|
+
result = await (0, index_js_1.executeAcademic)(this, domain, operation, i);
|
|
1589
74
|
break;
|
|
1590
|
-
}
|
|
1591
75
|
}
|
|
1592
|
-
|
|
1593
|
-
returnData.push(...executionData);
|
|
76
|
+
returnData.push({ json: result, pairedItem: { item: i } });
|
|
1594
77
|
}
|
|
1595
78
|
catch (error) {
|
|
1596
79
|
if (this.continueOnFail()) {
|
|
1597
|
-
let
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
}
|
|
1608
|
-
else {
|
|
1609
|
-
errorDetails = {
|
|
1610
|
-
error: errorMessage,
|
|
1611
|
-
statusCode: response.statusCode,
|
|
1612
|
-
};
|
|
1613
|
-
}
|
|
1614
|
-
if (response.statusCode === 401) {
|
|
1615
|
-
errorDetails.error = 'Invalid API key. Please check your PDFVector API credentials.';
|
|
1616
|
-
}
|
|
1617
|
-
else if (response.statusCode === 402) {
|
|
1618
|
-
errorDetails.error =
|
|
1619
|
-
'Insufficient credits. Please add more credits to your PDFVector account.';
|
|
1620
|
-
}
|
|
1621
|
-
else if (response.statusCode === 429) {
|
|
1622
|
-
errorDetails.error = 'Rate limit exceeded. Please wait before making more requests.';
|
|
1623
|
-
}
|
|
1624
|
-
else if (response.statusCode === 400) {
|
|
1625
|
-
errorDetails.error = `Bad request: ${errorDetails.error}`;
|
|
1626
|
-
}
|
|
80
|
+
let message;
|
|
81
|
+
if (error instanceof Error && 'code' in error) {
|
|
82
|
+
const err = error;
|
|
83
|
+
message = `[${err.code}] ${err.message}`;
|
|
84
|
+
}
|
|
85
|
+
else if (error instanceof Error) {
|
|
86
|
+
message = error.message;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
message = String(error);
|
|
1627
90
|
}
|
|
1628
|
-
|
|
1629
|
-
returnData.push(...executionErrorData);
|
|
91
|
+
returnData.push({ json: { error: message }, pairedItem: { item: i } });
|
|
1630
92
|
continue;
|
|
1631
93
|
}
|
|
1632
|
-
|
|
94
|
+
if (error && typeof error === 'object' && 'context' in error) {
|
|
95
|
+
const errorWithContext = error;
|
|
96
|
+
(_a = errorWithContext.context) !== null && _a !== void 0 ? _a : (errorWithContext.context = {});
|
|
97
|
+
errorWithContext.context.itemIndex = i;
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
if (error &&
|
|
101
|
+
typeof error === 'object' &&
|
|
102
|
+
('statusCode' in error || 'response' in error || 'httpCode' in error)) {
|
|
103
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { itemIndex: i });
|
|
104
|
+
}
|
|
105
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
|
|
1633
106
|
}
|
|
1634
107
|
}
|
|
1635
108
|
return [returnData];
|