@heripo/pdf-parser 0.1.38 → 0.1.40
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/dist/index.d.ts +8 -0
- package/dist/index.js +22 -16
- package/dist/index.js.map +1 -1
- package/package.json +7 -9
- package/dist/index.cjs +0 -11454
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -365
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,13 @@ interface PDFCorrectionOptions {
|
|
|
60
60
|
* text-correction stage runs. Defaults to true.
|
|
61
61
|
*/
|
|
62
62
|
reviewAssistanceEnabled?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* When false, the table-correction work item is not generated during review
|
|
65
|
+
* assistance scheduling. The rest of the review-assistance pipeline (text
|
|
66
|
+
* OCR, text integrity, footnotes, pictures, layout) continues to run. Only
|
|
67
|
+
* relevant when `reviewAssistanceEnabled` is true. Defaults to true.
|
|
68
|
+
*/
|
|
69
|
+
tableCorrectionEnabled?: boolean;
|
|
63
70
|
temperature?: number;
|
|
64
71
|
}
|
|
65
72
|
interface NormalizedPDFCorrectionOptions {
|
|
@@ -74,6 +81,7 @@ interface NormalizedPDFCorrectionOptions {
|
|
|
74
81
|
proposalThreshold: number;
|
|
75
82
|
forceAutoApply: boolean;
|
|
76
83
|
reviewAssistanceEnabled: boolean;
|
|
84
|
+
tableCorrectionEnabled: boolean;
|
|
77
85
|
temperature: number;
|
|
78
86
|
}
|
|
79
87
|
declare const PDF_CORRECTION_DEFAULTS: Omit<NormalizedPDFCorrectionOptions, 'models'>;
|
package/dist/index.js
CHANGED
|
@@ -64,7 +64,7 @@ var IMAGE_PDF_CONVERTER = {
|
|
|
64
64
|
QUALITY: 100
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
// ../shared/dist/index.
|
|
67
|
+
// ../shared/dist/index.js
|
|
68
68
|
import { spawn } from "child_process";
|
|
69
69
|
import {
|
|
70
70
|
NoObjectGeneratedError,
|
|
@@ -309,7 +309,7 @@ var LLMCaller = class {
|
|
|
309
309
|
return this.executeWithFallback(
|
|
310
310
|
config,
|
|
311
311
|
(model) => this.generateStructuredOutput(model, config.schema, {
|
|
312
|
-
|
|
312
|
+
instructions: config.systemPrompt,
|
|
313
313
|
prompt: config.userPrompt,
|
|
314
314
|
temperature: config.temperature,
|
|
315
315
|
maxRetries: config.maxRetries,
|
|
@@ -1328,8 +1328,8 @@ var PdfLanguageDetector = class {
|
|
|
1328
1328
|
text: KOREAN_DOCUMENT_DETECTION_PROMPT
|
|
1329
1329
|
},
|
|
1330
1330
|
{
|
|
1331
|
-
type: "
|
|
1332
|
-
|
|
1331
|
+
type: "file",
|
|
1332
|
+
data: imageData,
|
|
1333
1333
|
mediaType: "image/png"
|
|
1334
1334
|
}
|
|
1335
1335
|
]
|
|
@@ -3309,8 +3309,8 @@ var ReviewAssistancePageGate = class {
|
|
|
3309
3309
|
text: this.buildPrompt(context, options.outputLanguage)
|
|
3310
3310
|
},
|
|
3311
3311
|
{
|
|
3312
|
-
type: "
|
|
3313
|
-
image,
|
|
3312
|
+
type: "file",
|
|
3313
|
+
data: image,
|
|
3314
3314
|
mediaType: "image/png"
|
|
3315
3315
|
}
|
|
3316
3316
|
]
|
|
@@ -3582,8 +3582,8 @@ var PostDoclingPageProcessor = class {
|
|
|
3582
3582
|
text: fullPrompt
|
|
3583
3583
|
},
|
|
3584
3584
|
{
|
|
3585
|
-
type: "
|
|
3586
|
-
image,
|
|
3585
|
+
type: "file",
|
|
3586
|
+
data: image,
|
|
3587
3587
|
mediaType: "image/png"
|
|
3588
3588
|
}
|
|
3589
3589
|
]
|
|
@@ -7943,17 +7943,18 @@ var TEXT_ROLE_REASONS = /* @__PURE__ */ new Set([
|
|
|
7943
7943
|
]);
|
|
7944
7944
|
var SEVERE_TABLE_REASONS = /* @__PURE__ */ new Set(["multi_page_table_candidate"]);
|
|
7945
7945
|
var ReviewAssistanceWorkScheduler = class {
|
|
7946
|
-
build(context) {
|
|
7946
|
+
build(context, options) {
|
|
7947
7947
|
if (!context.reviewAssistanceEligibility.eligible) return [];
|
|
7948
|
-
|
|
7948
|
+
const items = [
|
|
7949
7949
|
...this.buildTextOcrItems(context),
|
|
7950
7950
|
...this.buildTextIntegrityItems(context),
|
|
7951
7951
|
...this.buildTextRoleItems(context),
|
|
7952
|
-
...this.buildTableItems(context),
|
|
7952
|
+
...options?.skipTableItems ? [] : this.buildTableItems(context),
|
|
7953
7953
|
...this.buildPictureCaptionItems(context),
|
|
7954
7954
|
...this.buildPictureSplitItems(context),
|
|
7955
7955
|
...this.buildLayoutItems(context)
|
|
7956
7956
|
];
|
|
7957
|
+
return items;
|
|
7957
7958
|
}
|
|
7958
7959
|
buildTextOcrItems(context) {
|
|
7959
7960
|
const targetRefs = context.textBlocks.filter(
|
|
@@ -9016,7 +9017,9 @@ var ReviewAssistanceRunner = class {
|
|
|
9016
9017
|
);
|
|
9017
9018
|
const image = new Uint8Array(await readFile(context.pageImagePath));
|
|
9018
9019
|
const scheduler = new ReviewAssistanceWorkScheduler();
|
|
9019
|
-
const workItems = scheduler.build(context
|
|
9020
|
+
const workItems = scheduler.build(context, {
|
|
9021
|
+
skipTableItems: !options.tableCorrectionEnabled
|
|
9022
|
+
});
|
|
9020
9023
|
if (workItems.length === 0) {
|
|
9021
9024
|
const result = {
|
|
9022
9025
|
pageNo: context.pageNo,
|
|
@@ -9204,8 +9207,8 @@ var ReviewAssistanceRunner = class {
|
|
|
9204
9207
|
content: [
|
|
9205
9208
|
{ type: "text", text: prompt },
|
|
9206
9209
|
{
|
|
9207
|
-
type: "
|
|
9208
|
-
image,
|
|
9210
|
+
type: "file",
|
|
9211
|
+
data: image,
|
|
9209
9212
|
mediaType: "image/png"
|
|
9210
9213
|
}
|
|
9211
9214
|
]
|
|
@@ -10030,8 +10033,8 @@ var ReviewAssistanceRunner = class {
|
|
|
10030
10033
|
content: [
|
|
10031
10034
|
{ type: "text", text: prompt },
|
|
10032
10035
|
{
|
|
10033
|
-
type: "
|
|
10034
|
-
image,
|
|
10036
|
+
type: "file",
|
|
10037
|
+
data: image,
|
|
10035
10038
|
mediaType: "image/png"
|
|
10036
10039
|
}
|
|
10037
10040
|
]
|
|
@@ -10469,6 +10472,7 @@ var PDF_CORRECTION_DEFAULTS = {
|
|
|
10469
10472
|
proposalThreshold: 0.5,
|
|
10470
10473
|
forceAutoApply: false,
|
|
10471
10474
|
reviewAssistanceEnabled: true,
|
|
10475
|
+
tableCorrectionEnabled: true,
|
|
10472
10476
|
temperature: 0
|
|
10473
10477
|
};
|
|
10474
10478
|
function normalizeNumber(value, fallback) {
|
|
@@ -10569,6 +10573,7 @@ function normalizePDFCorrectionOptions(value) {
|
|
|
10569
10573
|
proposalThreshold,
|
|
10570
10574
|
forceAutoApply: value.forceAutoApply ?? PDF_CORRECTION_DEFAULTS.forceAutoApply,
|
|
10571
10575
|
reviewAssistanceEnabled: value.reviewAssistanceEnabled ?? PDF_CORRECTION_DEFAULTS.reviewAssistanceEnabled,
|
|
10576
|
+
tableCorrectionEnabled: value.tableCorrectionEnabled ?? PDF_CORRECTION_DEFAULTS.tableCorrectionEnabled,
|
|
10572
10577
|
temperature: normalizeTemperature(
|
|
10573
10578
|
value.temperature,
|
|
10574
10579
|
PDF_CORRECTION_DEFAULTS.temperature
|
|
@@ -10637,6 +10642,7 @@ var PostDoclingCorrectionPipeline = class {
|
|
|
10637
10642
|
forceAutoApply: correction.forceAutoApply,
|
|
10638
10643
|
maxRetries: correction.maxRetries.reviewAssistance,
|
|
10639
10644
|
tableMaxRetries: correction.maxRetries.tableCorrection,
|
|
10645
|
+
tableCorrectionEnabled: correction.tableCorrectionEnabled,
|
|
10640
10646
|
temperature: correction.temperature,
|
|
10641
10647
|
outputLanguage: correction.outputLanguage,
|
|
10642
10648
|
aggregator: options.aggregator,
|