mindee 5.7.2 → 5.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.
- package/CHANGELOG.md +11 -1
- package/package.json +104 -95
- package/src/geometry/bbox.js +1 -1
- package/src/image/extractedImages.d.ts +1 -1
- package/src/image/imageExtractor.d.ts +1 -1
- package/src/image/imageExtractor.js +2 -2
- package/src/input/localInputSource.d.ts +1 -1
- package/src/parsing/baseLocalResponse.d.ts +1 -1
- package/src/pdf/extractedPdfs.d.ts +1 -1
- package/src/pdf/pdfExtractor.d.ts +1 -1
- package/src/pdf/pdfExtractor.js +2 -2
- package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.d.ts +2 -2
- package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.js +2 -2
- package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.d.ts +2 -2
- package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.js +1 -1
- package/src/v1/http/baseEndpoint.d.ts +1 -1
- package/src/v1/http/endpoint.d.ts +1 -1
- package/src/v1/http/endpoint.js +1 -1
- package/src/v1/http/httpParams.d.ts +1 -1
- package/src/v1/http/workflowEndpoint.d.ts +2 -2
- package/src/v1/http/workflowEndpoint.js +1 -1
- package/src/v1/parsing/common/execution.d.ts +1 -1
- package/src/v1/parsing/common/execution.js +1 -1
- package/src/v1/parsing/common/extras/cropperExtra.d.ts +1 -1
- package/src/v1/parsing/common/extras/cropperExtra.js +1 -1
- package/src/v1/parsing/common/ocrPage.d.ts +1 -1
- package/src/v1/parsing/common/ocrPage.js +1 -1
- package/src/v1/parsing/common/orientation.d.ts +1 -1
- package/src/v1/parsing/common/orientation.js +1 -1
- package/src/v1/parsing/generated/generatedList.d.ts +1 -1
- package/src/v1/parsing/generated/generatedList.js +1 -1
- package/src/v1/parsing/generated/generatedObject.d.ts +1 -1
- package/src/v1/parsing/generated/generatedObject.js +1 -1
- package/src/v1/parsing/localResponse.d.ts +1 -1
- package/src/v1/parsing/localResponse.js +1 -1
- package/src/v1/parsing/standard/amount.js +1 -1
- package/src/v1/parsing/standard/companyRegistration.js +1 -1
- package/src/v1/parsing/standard/tax.d.ts +1 -1
- package/src/v1/parsing/standard/tax.js +1 -1
- package/src/v1/product/barcodeReader/barcodeReaderV1.d.ts +1 -1
- package/src/v1/product/barcodeReader/barcodeReaderV1.js +1 -1
- package/src/v1/product/barcodeReader/barcodeReaderV1Document.d.ts +2 -2
- package/src/v1/product/barcodeReader/barcodeReaderV1Document.js +2 -2
- package/src/v1/product/cliProducts.d.ts +2 -2
- package/src/v1/product/cliProducts.js +1 -1
- package/src/v1/product/cropper/cropperV1.d.ts +1 -1
- package/src/v1/product/cropper/cropperV1.js +1 -1
- package/src/v1/product/cropper/cropperV1Document.d.ts +1 -1
- package/src/v1/product/cropper/cropperV1Page.d.ts +2 -2
- package/src/v1/product/cropper/cropperV1Page.js +2 -2
- package/src/v1/product/driverLicense/driverLicenseV1.d.ts +1 -1
- package/src/v1/product/driverLicense/driverLicenseV1.js +1 -1
- package/src/v1/product/driverLicense/driverLicenseV1Document.d.ts +2 -2
- package/src/v1/product/driverLicense/driverLicenseV1Document.js +2 -2
- package/src/v1/product/financialDocument/financialDocumentV1.d.ts +1 -1
- package/src/v1/product/financialDocument/financialDocumentV1.js +1 -1
- package/src/v1/product/financialDocument/financialDocumentV1Document.d.ts +2 -2
- package/src/v1/product/financialDocument/financialDocumentV1Document.js +2 -2
- package/src/v1/product/financialDocument/financialDocumentV1LineItem.js +1 -1
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +1 -1
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1.js +1 -1
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1Document.d.ts +2 -2
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1Document.js +2 -2
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2.d.ts +1 -1
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2.js +1 -1
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Document.d.ts +2 -2
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Document.js +2 -2
- package/src/v1/product/fr/carteGrise/carteGriseV1.d.ts +1 -1
- package/src/v1/product/fr/carteGrise/carteGriseV1.js +1 -1
- package/src/v1/product/fr/carteGrise/carteGriseV1Document.d.ts +2 -2
- package/src/v1/product/fr/carteGrise/carteGriseV1Document.js +2 -2
- package/src/v1/product/fr/idCard/idCardV2.d.ts +1 -1
- package/src/v1/product/fr/idCard/idCardV2.js +1 -1
- package/src/v1/product/fr/idCard/idCardV2Document.d.ts +2 -2
- package/src/v1/product/fr/idCard/idCardV2Document.js +2 -2
- package/src/v1/product/fr/idCard/idCardV2Page.d.ts +2 -2
- package/src/v1/product/fr/idCard/idCardV2Page.js +2 -2
- package/src/v1/product/generated/generatedV1.d.ts +1 -1
- package/src/v1/product/generated/generatedV1.js +1 -1
- package/src/v1/product/generated/generatedV1Document.js +2 -2
- package/src/v1/product/generated/generatedV1Page.js +2 -2
- package/src/v1/product/generated/generatedV1Prediction.d.ts +3 -3
- package/src/v1/product/generated/generatedV1Prediction.js +3 -3
- package/src/v1/product/internationalId/internationalIdV2.d.ts +1 -1
- package/src/v1/product/internationalId/internationalIdV2.js +1 -1
- package/src/v1/product/internationalId/internationalIdV2Document.d.ts +2 -2
- package/src/v1/product/internationalId/internationalIdV2Document.js +2 -2
- package/src/v1/product/invoice/invoiceV4.d.ts +1 -1
- package/src/v1/product/invoice/invoiceV4.js +1 -1
- package/src/v1/product/invoice/invoiceV4Document.d.ts +2 -2
- package/src/v1/product/invoice/invoiceV4Document.js +2 -2
- package/src/v1/product/invoice/invoiceV4LineItem.js +1 -1
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1.d.ts +1 -1
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1.js +1 -1
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1Document.d.ts +1 -1
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1Document.js +1 -1
- package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1.d.ts +1 -1
- package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1.js +1 -1
- package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.d.ts +2 -2
- package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.js +2 -2
- package/src/v1/product/passport/passportV1.d.ts +1 -1
- package/src/v1/product/passport/passportV1.js +1 -1
- package/src/v1/product/passport/passportV1Document.d.ts +2 -2
- package/src/v1/product/passport/passportV1Document.js +2 -2
- package/src/v1/product/receipt/receiptV5.d.ts +1 -1
- package/src/v1/product/receipt/receiptV5.js +1 -1
- package/src/v1/product/receipt/receiptV5Document.d.ts +2 -2
- package/src/v1/product/receipt/receiptV5Document.js +2 -2
- package/src/v1/product/receipt/receiptV5LineItem.js +1 -1
- package/src/v1/product/resume/resumeV1.d.ts +1 -1
- package/src/v1/product/resume/resumeV1.js +1 -1
- package/src/v1/product/resume/resumeV1Certificate.js +1 -1
- package/src/v1/product/resume/resumeV1Document.d.ts +2 -2
- package/src/v1/product/resume/resumeV1Document.js +2 -2
- package/src/v1/product/resume/resumeV1Education.js +1 -1
- package/src/v1/product/resume/resumeV1Language.js +1 -1
- package/src/v1/product/resume/resumeV1ProfessionalExperience.js +1 -1
- package/src/v1/product/resume/resumeV1SocialNetworksUrl.js +1 -1
- package/src/v1/product/us/bankCheck/bankCheckV1.d.ts +1 -1
- package/src/v1/product/us/bankCheck/bankCheckV1.js +1 -1
- package/src/v1/product/us/bankCheck/bankCheckV1Document.d.ts +2 -2
- package/src/v1/product/us/bankCheck/bankCheckV1Document.js +2 -2
- package/src/v1/product/us/bankCheck/bankCheckV1Page.d.ts +2 -2
- package/src/v1/product/us/bankCheck/bankCheckV1Page.js +2 -2
- package/src/v2/cli.js +1 -1
- package/src/v2/client.d.ts +94 -18
- package/src/v2/client.js +171 -27
- package/src/v2/clientOptions/baseAnnotationParameters.d.ts +23 -0
- package/src/v2/clientOptions/baseAnnotationParameters.js +17 -0
- package/src/v2/clientOptions/baseProductParameters.js +3 -2
- package/src/v2/clientOptions/baseRagDocumentUploadParameters.d.ts +23 -0
- package/src/v2/clientOptions/baseRagDocumentUploadParameters.js +24 -0
- package/src/v2/clientOptions/index.d.ts +2 -0
- package/src/v2/clientOptions/index.js +2 -0
- package/src/v2/fileOperations/crop.d.ts +1 -1
- package/src/v2/http/errors.d.ts +1 -1
- package/src/v2/http/mindeeApiV2.d.ts +35 -6
- package/src/v2/http/mindeeApiV2.js +91 -10
- package/src/v2/index.d.ts +1 -1
- package/src/v2/index.js +1 -1
- package/src/v2/parsing/baseRagAnnotationResponse.d.ts +28 -0
- package/src/v2/parsing/baseRagAnnotationResponse.js +14 -0
- package/src/v2/parsing/baseResponse.d.ts +6 -2
- package/src/v2/parsing/baseResponse.js +3 -1
- package/src/v2/parsing/error/errorItem.d.ts +1 -1
- package/src/v2/parsing/error/errorItem.js +1 -3
- package/src/v2/parsing/error/errorResponse.d.ts +5 -1
- package/src/v2/parsing/error/errorResponse.js +27 -1
- package/src/v2/parsing/index.d.ts +3 -1
- package/src/v2/parsing/index.js +2 -1
- package/src/v2/parsing/inference/failedInferenceResponse.d.ts +2 -2
- package/src/v2/parsing/inference/failedInferenceResponse.js +2 -2
- package/src/v2/parsing/inference/field/inferenceFields.d.ts +9 -3
- package/src/v2/parsing/inference/field/inferenceFields.js +9 -3
- package/src/v2/parsing/inference/field/objectField.d.ts +13 -9
- package/src/v2/parsing/inference/field/objectField.js +19 -33
- package/src/v2/parsing/inference/index.d.ts +1 -0
- package/src/v2/parsing/inference/index.js +1 -0
- package/src/v2/parsing/job/job.d.ts +8 -8
- package/src/v2/parsing/job/job.js +1 -1
- package/src/v2/parsing/job/jobResponse.d.ts +1 -1
- package/src/v2/parsing/job/jobResponse.js +1 -1
- package/src/v2/parsing/job/jobWebhook.d.ts +1 -1
- package/src/v2/parsing/job/jobWebhook.js +1 -1
- package/src/v2/parsing/search/baseSearchResponse.d.ts +1 -1
- package/src/v2/parsing/search/baseSearchResponse.js +1 -1
- package/src/v2/parsing/search/searchModels.d.ts +1 -1
- package/src/v2/parsing/search/searchModels.js +1 -1
- package/src/v2/parsing/search/searchRagDocuments.d.ts +1 -1
- package/src/v2/parsing/search/searchRagDocuments.js +1 -1
- package/src/v2/parsing/search/searchResponse.d.ts +1 -1
- package/src/v2/parsing/search/searchResponse.js +1 -1
- package/src/v2/product/baseProduct.d.ts +26 -6
- package/src/v2/product/baseProduct.js +31 -7
- package/src/v2/product/classification/classification.d.ts +1 -1
- package/src/v2/product/classification/classification.js +1 -1
- package/src/v2/product/classification/classificationClassifier.d.ts +1 -1
- package/src/v2/product/classification/classificationClassifier.js +1 -1
- package/src/v2/product/classification/classificationInference.d.ts +1 -1
- package/src/v2/product/classification/classificationInference.js +1 -1
- package/src/v2/product/classification/classificationResponse.d.ts +1 -1
- package/src/v2/product/classification/classificationResponse.js +1 -1
- package/src/v2/product/classification/params/classificationParameters.d.ts +1 -1
- package/src/v2/product/classification/params/classificationParameters.js +1 -1
- package/src/v2/product/crop/crop.d.ts +1 -1
- package/src/v2/product/crop/crop.js +1 -1
- package/src/v2/product/crop/cropInference.d.ts +2 -2
- package/src/v2/product/crop/cropInference.js +2 -2
- package/src/v2/product/crop/cropItem.d.ts +2 -2
- package/src/v2/product/crop/cropItem.js +3 -3
- package/src/v2/product/crop/cropResponse.d.ts +1 -1
- package/src/v2/product/crop/cropResponse.js +1 -1
- package/src/v2/product/crop/cropResult.d.ts +1 -1
- package/src/v2/product/crop/cropResult.js +2 -2
- package/src/v2/product/crop/params/cropParameters.d.ts +1 -1
- package/src/v2/product/crop/params/cropParameters.js +1 -1
- package/src/v2/product/extraction/extraction.d.ts +10 -2
- package/src/v2/product/extraction/extraction.js +17 -3
- package/src/v2/product/extraction/extractionInference.d.ts +1 -1
- package/src/v2/product/extraction/extractionInference.js +1 -1
- package/src/v2/product/extraction/extractionResponse.d.ts +1 -1
- package/src/v2/product/extraction/extractionResponse.js +1 -1
- package/src/v2/product/extraction/extractionResult.d.ts +3 -3
- package/src/v2/product/extraction/extractionResult.js +3 -3
- package/src/v2/product/extraction/index.d.ts +1 -0
- package/src/v2/product/extraction/index.js +1 -0
- package/src/v2/product/extraction/params/extractionParameters.d.ts +1 -1
- package/src/v2/product/extraction/params/extractionParameters.js +1 -1
- package/src/v2/product/extraction/ragDocuments/annotatedBaseField.d.ts +20 -0
- package/src/v2/product/extraction/ragDocuments/annotatedBaseField.js +15 -0
- package/src/v2/product/extraction/ragDocuments/annotatedFields.d.ts +27 -0
- package/src/v2/product/extraction/ragDocuments/annotatedFields.js +57 -0
- package/src/v2/product/extraction/ragDocuments/annotatedListField.d.ts +24 -0
- package/src/v2/product/extraction/ragDocuments/annotatedListField.js +67 -0
- package/src/v2/product/extraction/ragDocuments/annotatedObjectField.d.ts +43 -0
- package/src/v2/product/extraction/ragDocuments/annotatedObjectField.js +47 -0
- package/src/v2/product/extraction/ragDocuments/annotatedSimpleField.d.ts +15 -0
- package/src/v2/product/extraction/ragDocuments/annotatedSimpleField.js +13 -0
- package/src/v2/product/extraction/ragDocuments/extractionRagAnnotationResponse.d.ts +25 -0
- package/src/v2/product/extraction/ragDocuments/extractionRagAnnotationResponse.js +17 -0
- package/src/v2/product/extraction/ragDocuments/fieldFactory.d.ts +12 -0
- package/src/v2/product/extraction/ragDocuments/fieldFactory.js +23 -0
- package/src/v2/product/extraction/ragDocuments/index.d.ts +7 -0
- package/src/v2/product/extraction/ragDocuments/index.js +7 -0
- package/src/v2/product/extraction/ragDocuments/params/index.d.ts +2 -0
- package/src/v2/product/extraction/ragDocuments/params/index.js +2 -0
- package/src/v2/product/extraction/ragDocuments/params/ragDocumentAnnotationParameters.d.ts +27 -0
- package/src/v2/product/extraction/ragDocuments/params/ragDocumentAnnotationParameters.js +43 -0
- package/src/v2/product/extraction/ragDocuments/params/ragDocumentUploadParameters.d.ts +7 -0
- package/src/v2/product/extraction/ragDocuments/params/ragDocumentUploadParameters.js +9 -0
- package/src/v2/product/extraction/ragDocuments/ragAnnotation.d.ts +12 -0
- package/src/v2/product/extraction/ragDocuments/ragAnnotation.js +9 -0
- package/src/v2/product/ocr/ocr.d.ts +1 -1
- package/src/v2/product/ocr/ocr.js +1 -1
- package/src/v2/product/ocr/ocrInference.d.ts +2 -2
- package/src/v2/product/ocr/ocrInference.js +2 -2
- package/src/v2/product/ocr/ocrResponse.d.ts +1 -1
- package/src/v2/product/ocr/ocrResponse.js +1 -1
- package/src/v2/product/ocr/params/ocrParameters.d.ts +1 -1
- package/src/v2/product/ocr/params/ocrParameters.js +1 -1
- package/src/v2/product/split/params/splitParameters.d.ts +1 -1
- package/src/v2/product/split/params/splitParameters.js +1 -1
- package/src/v2/product/split/split.d.ts +1 -1
- package/src/v2/product/split/split.js +1 -1
- package/src/v2/product/split/splitInference.d.ts +1 -1
- package/src/v2/product/split/splitInference.js +1 -1
- package/src/v2/product/split/splitRange.d.ts +1 -1
- package/src/v2/product/split/splitRange.js +2 -2
- package/src/v2/product/split/splitResponse.d.ts +1 -1
- package/src/v2/product/split/splitResponse.js +1 -1
- package/src/v2/product/split/splitResult.js +1 -1
- package/src/v2/search/baseSearch.d.ts +2 -2
- package/src/v2/search/models/modelSearch.d.ts +3 -3
- package/src/v2/search/models/modelSearch.js +3 -3
- package/src/v2/search/models/modelSearchParameters.d.ts +1 -1
- package/src/v2/search/models/modelSearchParameters.js +1 -1
- package/src/v2/search/models/modelSearchResponse.d.ts +2 -2
- package/src/v2/search/models/modelSearchResponse.js +2 -2
- package/src/v2/search/ragDocuments/ragDocumentSearch.d.ts +3 -3
- package/src/v2/search/ragDocuments/ragDocumentSearch.js +3 -3
- package/src/v2/search/ragDocuments/ragDocumentSearchParameters.d.ts +1 -1
- package/src/v2/search/ragDocuments/ragDocumentSearchParameters.js +1 -1
- package/src/v2/search/ragDocuments/ragDocumentSearchResponse.d.ts +2 -2
- package/src/v2/search/ragDocuments/ragDocumentSearchResponse.js +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Prediction, StringDict } from "
|
|
1
|
+
import { Prediction, StringDict } from "../../parsing/common/index.js";
|
|
2
2
|
import { ResumeV1SocialNetworksUrl } from "./resumeV1SocialNetworksUrl.js";
|
|
3
3
|
import { ResumeV1Language } from "./resumeV1Language.js";
|
|
4
4
|
import { ResumeV1Education } from "./resumeV1Education.js";
|
|
5
5
|
import { ResumeV1ProfessionalExperience } from "./resumeV1ProfessionalExperience.js";
|
|
6
6
|
import { ResumeV1Certificate } from "./resumeV1Certificate.js";
|
|
7
|
-
import { ClassificationField, StringField } from "
|
|
7
|
+
import { ClassificationField, StringField } from "../../parsing/standard/index.js";
|
|
8
8
|
/**
|
|
9
9
|
* Resume API version 1.2 document data.
|
|
10
10
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { cleanOutString, lineSeparator, } from "
|
|
1
|
+
import { cleanOutString, lineSeparator, } from "../../parsing/common/index.js";
|
|
2
2
|
import { ResumeV1SocialNetworksUrl } from "./resumeV1SocialNetworksUrl.js";
|
|
3
3
|
import { ResumeV1Language } from "./resumeV1Language.js";
|
|
4
4
|
import { ResumeV1Education } from "./resumeV1Education.js";
|
|
5
5
|
import { ResumeV1ProfessionalExperience } from "./resumeV1ProfessionalExperience.js";
|
|
6
6
|
import { ResumeV1Certificate } from "./resumeV1Certificate.js";
|
|
7
|
-
import { ClassificationField, StringField } from "
|
|
7
|
+
import { ClassificationField, StringField } from "../../parsing/standard/index.js";
|
|
8
8
|
/**
|
|
9
9
|
* Resume API version 1.2 document data.
|
|
10
10
|
*/
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _ResumeV1Education_instances, _ResumeV1Education_printableValues;
|
|
7
|
-
import { cleanAndTruncate } from "
|
|
7
|
+
import { cleanAndTruncate } from "../../parsing/common/index.js";
|
|
8
8
|
import { Polygon } from "../../../geometry/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* The list of the candidate's educational background.
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _ResumeV1Language_instances, _ResumeV1Language_printableValues;
|
|
7
|
-
import { cleanAndTruncate } from "
|
|
7
|
+
import { cleanAndTruncate } from "../../parsing/common/index.js";
|
|
8
8
|
import { Polygon } from "../../../geometry/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* The list of languages that the candidate is proficient in.
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _ResumeV1ProfessionalExperience_instances, _ResumeV1ProfessionalExperience_printableValues;
|
|
7
|
-
import { cleanAndTruncate } from "
|
|
7
|
+
import { cleanAndTruncate } from "../../parsing/common/index.js";
|
|
8
8
|
import { Polygon } from "../../../geometry/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* The list of the candidate's professional experiences.
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _ResumeV1SocialNetworksUrl_instances, _ResumeV1SocialNetworksUrl_printableValues;
|
|
7
|
-
import { cleanAndTruncate } from "
|
|
7
|
+
import { cleanAndTruncate } from "../../parsing/common/index.js";
|
|
8
8
|
import { Polygon } from "../../../geometry/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* The list of social network profiles of the candidate.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Inference, StringDict, Page } from "
|
|
1
|
+
import { Inference, StringDict, Page } from "../../../parsing/common/index.js";
|
|
2
2
|
import { BankCheckV1Document } from "./bankCheckV1Document.js";
|
|
3
3
|
import { BankCheckV1Page } from "./bankCheckV1Page.js";
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Inference, Page } from "
|
|
1
|
+
import { Inference, Page } from "../../../parsing/common/index.js";
|
|
2
2
|
import { BankCheckV1Document } from "./bankCheckV1Document.js";
|
|
3
3
|
import { BankCheckV1Page } from "./bankCheckV1Page.js";
|
|
4
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Prediction, StringDict } from "
|
|
2
|
-
import { AmountField, DateField, StringField } from "
|
|
1
|
+
import { Prediction, StringDict } from "../../../parsing/common/index.js";
|
|
2
|
+
import { AmountField, DateField, StringField } from "../../../parsing/standard/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Bank Check API version 1.1 document data.
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cleanOutString, } from "
|
|
2
|
-
import { AmountField, DateField, StringField, } from "
|
|
1
|
+
import { cleanOutString, } from "../../../parsing/common/index.js";
|
|
2
|
+
import { AmountField, DateField, StringField, } from "../../../parsing/standard/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Bank Check API version 1.1 document data.
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StringDict } from "
|
|
2
|
-
import { PositionField } from "
|
|
1
|
+
import { StringDict } from "../../../parsing/common/index.js";
|
|
2
|
+
import { PositionField } from "../../../parsing/standard/index.js";
|
|
3
3
|
import { BankCheckV1Document } from "./bankCheckV1Document.js";
|
|
4
4
|
/**
|
|
5
5
|
* Bank Check API version 1.1 page data.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cleanOutString } from "
|
|
2
|
-
import { PositionField } from "
|
|
1
|
+
import { cleanOutString } from "../../../parsing/common/index.js";
|
|
2
|
+
import { PositionField } from "../../../parsing/standard/index.js";
|
|
3
3
|
import { BankCheckV1Document } from "./bankCheckV1Document.js";
|
|
4
4
|
/**
|
|
5
5
|
* Bank Check API version 1.1 page data.
|
package/src/v2/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import * as console from "console";
|
|
3
3
|
import { Client, PathInput, UrlInput } from "../index.js";
|
|
4
|
-
import { Classification, Crop, Extraction, Ocr, Split, } from "
|
|
4
|
+
import { Classification, Crop, Extraction, Ocr, Split, } from "./product/index.js";
|
|
5
5
|
const program = new Command();
|
|
6
6
|
//
|
|
7
7
|
// EXECUTE THE COMMANDS
|
package/src/v2/client.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ import { JobResponse } from "./parsing/index.js";
|
|
|
4
4
|
import { SearchResponse } from "./parsing/search/index.js";
|
|
5
5
|
import { MindeeApiV2 } from "./http/mindeeApiV2.js";
|
|
6
6
|
import { PollingOptions, PollingOptionsConstructor } from "./clientOptions/index.js";
|
|
7
|
-
import { BaseProduct } from "
|
|
8
|
-
import { BaseSearch } from "
|
|
7
|
+
import { BaseProduct } from "./product/baseProduct.js";
|
|
8
|
+
import { BaseSearch } from "./search/baseSearch.js";
|
|
9
|
+
import { LocalInputSource } from "../input/index.js";
|
|
9
10
|
/**
|
|
10
11
|
* Options for the V2 Mindee Client.
|
|
11
12
|
* @example
|
|
@@ -27,28 +28,17 @@ export interface ClientOptions {
|
|
|
27
28
|
* Mindee Client V2 class that centralizes most basic operations.
|
|
28
29
|
*/
|
|
29
30
|
export declare class Client {
|
|
30
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Mindee V2 API handler.
|
|
33
|
+
*/
|
|
31
34
|
protected mindeeApi: MindeeApiV2;
|
|
32
35
|
/**
|
|
33
36
|
* @param {ClientOptions} options options for the initialization of a client.
|
|
34
37
|
*/
|
|
35
38
|
constructor({ apiKey, debug, dispatcher }?: ClientOptions);
|
|
36
39
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @param name Optional name filter.
|
|
39
|
-
* @param modelType Optional model type filter.
|
|
40
|
-
* @returns a `Promise` containing the search response.
|
|
41
|
-
* @deprecated Use `search(ModelSearch, {})` instead.
|
|
40
|
+
* Enqueues a product inference job without waiting for completion.
|
|
42
41
|
*/
|
|
43
|
-
searchModels(name?: string, modelType?: string): Promise<SearchResponse>;
|
|
44
|
-
/**
|
|
45
|
-
* Search for resources matching the given criteria.
|
|
46
|
-
* @param search Search definition class to use.
|
|
47
|
-
* @param searchParameters Search parameters.
|
|
48
|
-
* @returns a `Promise` containing the search response with the matching resources.
|
|
49
|
-
*/
|
|
50
|
-
search<S extends typeof BaseSearch>(search: S, searchParameters: InstanceType<S["parametersClass"]> | ConstructorParameters<S["parametersClass"]>[0]): Promise<InstanceType<S["responseClass"]>>;
|
|
51
|
-
/** Enqueues a product inference job without waiting for completion. */
|
|
52
42
|
enqueue<P extends typeof BaseProduct>(product: P, inputSource: InputSource, params: InstanceType<P["parametersClass"]> | ConstructorParameters<P["parametersClass"]>[0]): Promise<JobResponse>;
|
|
53
43
|
/**
|
|
54
44
|
* Retrieves the result of a previously enqueued request.
|
|
@@ -91,11 +81,97 @@ export declare class Client {
|
|
|
91
81
|
* @typeParam T an extension of an `Inference`. Can be omitted as it will be inferred from the `productClass`.
|
|
92
82
|
* @returns a `Promise` containing parsing results.
|
|
93
83
|
*/
|
|
94
|
-
enqueueAndGetResult<P extends typeof BaseProduct>(product: P, inputSource: InputSource, params: InstanceType<P["parametersClass"]> | ConstructorParameters<P["parametersClass"]>[0], pollingOptions?: PollingOptionsConstructor): Promise<InstanceType<P["responseClass"]>>;
|
|
84
|
+
enqueueAndGetResult<P extends typeof BaseProduct>(product: P, inputSource: InputSource, params: InstanceType<P["parametersClass"]> | ConstructorParameters<P["parametersClass"]>[0], pollingOptions?: PollingOptions | PollingOptionsConstructor): Promise<InstanceType<P["responseClass"]>>;
|
|
95
85
|
/**
|
|
96
86
|
* Send a document to an endpoint and poll the server until the result is sent or
|
|
97
87
|
* until the maximum number of tries is reached.
|
|
98
88
|
* @protected
|
|
99
89
|
*/
|
|
100
90
|
protected pollForResult<P extends typeof BaseProduct>(product: typeof BaseProduct, pollingOptions: PollingOptions, jobResponse: JobResponse): Promise<InstanceType<P["responseClass"]>>;
|
|
91
|
+
/**
|
|
92
|
+
* Search for models available to the account.
|
|
93
|
+
* @param name Optional name filter.
|
|
94
|
+
* @param modelType Optional model type filter.
|
|
95
|
+
* @returns a `Promise` containing the search response.
|
|
96
|
+
* @deprecated Use `search(ModelSearch, {})` instead.
|
|
97
|
+
*/
|
|
98
|
+
searchModels(name?: string, modelType?: string): Promise<SearchResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* Search for resources matching the given criteria.
|
|
101
|
+
* @param search Search definition class to use.
|
|
102
|
+
* @param searchParameters Search parameters.
|
|
103
|
+
* @returns a `Promise` containing the search response with the matching resources.
|
|
104
|
+
*/
|
|
105
|
+
search<S extends typeof BaseSearch>(search: S, searchParameters: InstanceType<S["parametersClass"]> | ConstructorParameters<S["parametersClass"]>[0]): Promise<InstanceType<S["responseClass"]>>;
|
|
106
|
+
/**
|
|
107
|
+
* Not recommended for general use, prefer `getReadyRagDocumentPoll`.
|
|
108
|
+
* You will need to poll until the document is ready for use.
|
|
109
|
+
* Get a document's info and annotations from the RAG database.
|
|
110
|
+
*
|
|
111
|
+
* @param product the product the RAG database belongs to.
|
|
112
|
+
* @param documentId the document's ID.
|
|
113
|
+
*/
|
|
114
|
+
getRagDocument<P extends typeof BaseProduct>(product: P, documentId: string): Promise<InstanceType<P["annotationResponseClass"]>>;
|
|
115
|
+
/**
|
|
116
|
+
* Get a document's info and annotations from the RAG database.
|
|
117
|
+
*
|
|
118
|
+
* @param product the product the RAG database belongs to.
|
|
119
|
+
* @param documentId the document's ID.
|
|
120
|
+
* @param pollingOptions options for the polling loop, see {@link PollingOptions}.
|
|
121
|
+
* @returns a `Promise` containing the RAG document annotation.
|
|
122
|
+
*/
|
|
123
|
+
getReadyRagDocumentPoll<P extends typeof BaseProduct>(product: P, documentId: string, pollingOptions?: PollingOptions | PollingOptionsConstructor): Promise<InstanceType<P["annotationResponseClass"]>>;
|
|
124
|
+
/**
|
|
125
|
+
* Not recommended for general use, prefer `uploadAndGetRagDocumentPoll`.
|
|
126
|
+
* You will need to poll until the document is ready for use.
|
|
127
|
+
* Add a document to the RAG database.
|
|
128
|
+
*
|
|
129
|
+
* @param product The product the RAG database belongs to.
|
|
130
|
+
* @param inputSource The file to upload.
|
|
131
|
+
* @param parameters The parameters to use for the upload.
|
|
132
|
+
*/
|
|
133
|
+
uploadRagDocument<P extends typeof BaseProduct>(product: P, inputSource: LocalInputSource, parameters: InstanceType<P["ragDocumentUploadClass"]> | ConstructorParameters<P["ragDocumentUploadClass"]>[0]): Promise<InstanceType<P["annotationResponseClass"]>>;
|
|
134
|
+
/**
|
|
135
|
+
* Add a document to the RAG database and return the initial annotation.
|
|
136
|
+
*
|
|
137
|
+
* @param product The product the RAG database belongs to.
|
|
138
|
+
* @param inputSource The file to upload.
|
|
139
|
+
* @param parameters The parameters to use for the upload.
|
|
140
|
+
* @param pollingOptions options for the polling loop, see {@link PollingOptions}.
|
|
141
|
+
*/
|
|
142
|
+
uploadAndGetRagDocumentPoll<P extends typeof BaseProduct>(product: P, inputSource: LocalInputSource, parameters: InstanceType<P["ragDocumentUploadClass"]> | ConstructorParameters<P["ragDocumentUploadClass"]>[0], pollingOptions?: PollingOptions | PollingOptionsConstructor): Promise<InstanceType<P["annotationResponseClass"]>>;
|
|
143
|
+
/**
|
|
144
|
+
* Not recommended for general use, prefer `updateAndGetRagAnnotationPoll`.
|
|
145
|
+
* You will need to poll until the document is ready for use.
|
|
146
|
+
* Update a document's annotations in the RAG database.
|
|
147
|
+
*
|
|
148
|
+
* @param product The product the RAG database belongs to.
|
|
149
|
+
* @param parameters The parameters to use for the update.
|
|
150
|
+
*/
|
|
151
|
+
updateRagAnnotation<P extends typeof BaseProduct>(product: P, parameters: InstanceType<P["annotationParametersClass"]> | ConstructorParameters<P["annotationParametersClass"]>[0]): Promise<InstanceType<P["annotationResponseClass"]>>;
|
|
152
|
+
/**
|
|
153
|
+
* Update a document's annotations in the RAG database and poll until ready.
|
|
154
|
+
*
|
|
155
|
+
* @param product The product the RAG database belongs to.
|
|
156
|
+
* @param parameters The parameters to use for the update.
|
|
157
|
+
* @param pollingOptions options for the polling loop, see {@link PollingOptions}.
|
|
158
|
+
* @returns a `Promise` containing the RAG document annotation.
|
|
159
|
+
*/
|
|
160
|
+
updateAndGetRagAnnotationPoll<P extends typeof BaseProduct>(product: P, parameters: InstanceType<P["annotationParametersClass"]> | ConstructorParameters<P["annotationParametersClass"]>[0], pollingOptions?: PollingOptions | PollingOptionsConstructor): Promise<InstanceType<P["annotationResponseClass"]>>;
|
|
161
|
+
/**
|
|
162
|
+
* Deletes a document from the RAG database.
|
|
163
|
+
* @param product the product the RAG database belongs to.
|
|
164
|
+
* @param documentId the document's ID.
|
|
165
|
+
*/
|
|
166
|
+
deleteRagDocument<P extends typeof BaseProduct>(product: P, documentId: string): Promise<boolean>;
|
|
167
|
+
/**
|
|
168
|
+
* Poll until the document is finished processing or the max number of attempts is reached.
|
|
169
|
+
*
|
|
170
|
+
* @param product The product the RAG database belongs to.
|
|
171
|
+
* @param initialResponse The initial response containing the document's ID.
|
|
172
|
+
* @param pollingOptions Options for the polling loop, see {@link PollingOptions}.
|
|
173
|
+
* @returns A `Promise` containing the RAG document annotation.
|
|
174
|
+
* @protected
|
|
175
|
+
*/
|
|
176
|
+
protected pollForRagDocument<P extends typeof BaseProduct>(product: P, initialResponse: InstanceType<P["annotationResponseClass"]>, pollingOptions: PollingOptions): Promise<InstanceType<P["annotationResponseClass"]>>;
|
|
101
177
|
}
|
package/src/v2/client.js
CHANGED
|
@@ -5,7 +5,7 @@ import { LOG_LEVELS, logger } from "../logger.js";
|
|
|
5
5
|
import { MindeeApiV2 } from "./http/mindeeApiV2.js";
|
|
6
6
|
import { MindeeHttpErrorV2 } from "./http/errors.js";
|
|
7
7
|
import { PollingOptions } from "./clientOptions/index.js";
|
|
8
|
-
import { ModelSearch } from "
|
|
8
|
+
import { ModelSearch } from "./search/models/modelSearch.js";
|
|
9
9
|
/**
|
|
10
10
|
* Mindee Client V2 class that centralizes most basic operations.
|
|
11
11
|
*/
|
|
@@ -27,31 +27,8 @@ export class Client {
|
|
|
27
27
|
logger.debug("Client V2 Initialized");
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
* @param name Optional name filter.
|
|
32
|
-
* @param modelType Optional model type filter.
|
|
33
|
-
* @returns a `Promise` containing the search response.
|
|
34
|
-
* @deprecated Use `search(ModelSearch, {})` instead.
|
|
35
|
-
*/
|
|
36
|
-
async searchModels(name, modelType) {
|
|
37
|
-
return await this.search(ModelSearch, { name: name, modelType: modelType });
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Search for resources matching the given criteria.
|
|
41
|
-
* @param search Search definition class to use.
|
|
42
|
-
* @param searchParameters Search parameters.
|
|
43
|
-
* @returns a `Promise` containing the search response with the matching resources.
|
|
30
|
+
* Enqueues a product inference job without waiting for completion.
|
|
44
31
|
*/
|
|
45
|
-
async search(search, searchParameters) {
|
|
46
|
-
if (!searchParameters) {
|
|
47
|
-
throw new MindeeError("Search parameters are required.");
|
|
48
|
-
}
|
|
49
|
-
const paramsInstance = searchParameters instanceof search.parametersClass
|
|
50
|
-
? searchParameters
|
|
51
|
-
: new search.parametersClass(searchParameters);
|
|
52
|
-
return await this.mindeeApi.reqGetSearch(search, paramsInstance);
|
|
53
|
-
}
|
|
54
|
-
/** Enqueues a product inference job without waiting for completion. */
|
|
55
32
|
async enqueue(product, inputSource, params) {
|
|
56
33
|
if (inputSource === undefined) {
|
|
57
34
|
throw new MindeeError("An input document is required.");
|
|
@@ -118,9 +95,13 @@ export class Client {
|
|
|
118
95
|
* @returns a `Promise` containing parsing results.
|
|
119
96
|
*/
|
|
120
97
|
async enqueueAndGetResult(product, inputSource, params, pollingOptions) {
|
|
121
|
-
const paramsInstance =
|
|
122
|
-
|
|
98
|
+
const paramsInstance = params instanceof product.parametersClass
|
|
99
|
+
? params
|
|
100
|
+
: new product.parametersClass(params);
|
|
123
101
|
const jobResponse = await this.enqueue(product, inputSource, paramsInstance);
|
|
102
|
+
const pollingOptionsInstance = pollingOptions instanceof PollingOptions
|
|
103
|
+
? pollingOptions
|
|
104
|
+
: new PollingOptions(pollingOptions);
|
|
124
105
|
return await this.pollForResult(product, pollingOptionsInstance, jobResponse);
|
|
125
106
|
}
|
|
126
107
|
/**
|
|
@@ -157,4 +138,167 @@ export class Client {
|
|
|
157
138
|
throw new MindeeError(`Polling failed to retrieve a result after ${retryCounter} attempts. ` +
|
|
158
139
|
"You can increase poll attempts by passing the pollingOptions argument to enqueueAndGetResult()");
|
|
159
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Search for models available to the account.
|
|
143
|
+
* @param name Optional name filter.
|
|
144
|
+
* @param modelType Optional model type filter.
|
|
145
|
+
* @returns a `Promise` containing the search response.
|
|
146
|
+
* @deprecated Use `search(ModelSearch, {})` instead.
|
|
147
|
+
*/
|
|
148
|
+
async searchModels(name, modelType) {
|
|
149
|
+
return await this.search(ModelSearch, { name: name, modelType: modelType });
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Search for resources matching the given criteria.
|
|
153
|
+
* @param search Search definition class to use.
|
|
154
|
+
* @param searchParameters Search parameters.
|
|
155
|
+
* @returns a `Promise` containing the search response with the matching resources.
|
|
156
|
+
*/
|
|
157
|
+
async search(search, searchParameters) {
|
|
158
|
+
if (!searchParameters) {
|
|
159
|
+
throw new MindeeError("Search parameters are required.");
|
|
160
|
+
}
|
|
161
|
+
const paramsInstance = searchParameters instanceof search.parametersClass
|
|
162
|
+
? searchParameters
|
|
163
|
+
: new search.parametersClass(searchParameters);
|
|
164
|
+
return await this.mindeeApi.reqGetSearch(search, paramsInstance);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Not recommended for general use, prefer `getReadyRagDocumentPoll`.
|
|
168
|
+
* You will need to poll until the document is ready for use.
|
|
169
|
+
* Get a document's info and annotations from the RAG database.
|
|
170
|
+
*
|
|
171
|
+
* @param product the product the RAG database belongs to.
|
|
172
|
+
* @param documentId the document's ID.
|
|
173
|
+
*/
|
|
174
|
+
async getRagDocument(product, documentId) {
|
|
175
|
+
logger.debug(`Getting RAG document ID: ${documentId}`);
|
|
176
|
+
return await this.mindeeApi.reqGetRagAnnotation(product, documentId);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Get a document's info and annotations from the RAG database.
|
|
180
|
+
*
|
|
181
|
+
* @param product the product the RAG database belongs to.
|
|
182
|
+
* @param documentId the document's ID.
|
|
183
|
+
* @param pollingOptions options for the polling loop, see {@link PollingOptions}.
|
|
184
|
+
* @returns a `Promise` containing the RAG document annotation.
|
|
185
|
+
*/
|
|
186
|
+
async getReadyRagDocumentPoll(product, documentId, pollingOptions) {
|
|
187
|
+
const initialResponse = await this.getRagDocument(product, documentId);
|
|
188
|
+
if (initialResponse.status !== "Processing") {
|
|
189
|
+
return initialResponse;
|
|
190
|
+
}
|
|
191
|
+
const pollingOptionsInstance = pollingOptions instanceof PollingOptions
|
|
192
|
+
? pollingOptions
|
|
193
|
+
: new PollingOptions(pollingOptions);
|
|
194
|
+
return await this.pollForRagDocument(product, initialResponse, pollingOptionsInstance);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Not recommended for general use, prefer `uploadAndGetRagDocumentPoll`.
|
|
198
|
+
* You will need to poll until the document is ready for use.
|
|
199
|
+
* Add a document to the RAG database.
|
|
200
|
+
*
|
|
201
|
+
* @param product The product the RAG database belongs to.
|
|
202
|
+
* @param inputSource The file to upload.
|
|
203
|
+
* @param parameters The parameters to use for the upload.
|
|
204
|
+
*/
|
|
205
|
+
async uploadRagDocument(product, inputSource, parameters) {
|
|
206
|
+
logger.debug("Adding a document to the RAG database");
|
|
207
|
+
const paramsInstance = parameters instanceof product.ragDocumentUploadClass
|
|
208
|
+
? parameters
|
|
209
|
+
: new product.ragDocumentUploadClass(parameters);
|
|
210
|
+
await inputSource.init();
|
|
211
|
+
return await this.mindeeApi.reqPostRagDocument(product, paramsInstance, inputSource);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Add a document to the RAG database and return the initial annotation.
|
|
215
|
+
*
|
|
216
|
+
* @param product The product the RAG database belongs to.
|
|
217
|
+
* @param inputSource The file to upload.
|
|
218
|
+
* @param parameters The parameters to use for the upload.
|
|
219
|
+
* @param pollingOptions options for the polling loop, see {@link PollingOptions}.
|
|
220
|
+
*/
|
|
221
|
+
async uploadAndGetRagDocumentPoll(product, inputSource, parameters, pollingOptions) {
|
|
222
|
+
const initialResponse = await this.uploadRagDocument(product, inputSource, parameters);
|
|
223
|
+
if (initialResponse.status !== "Processing") {
|
|
224
|
+
return initialResponse;
|
|
225
|
+
}
|
|
226
|
+
const pollingOptionsInstance = pollingOptions instanceof PollingOptions
|
|
227
|
+
? pollingOptions
|
|
228
|
+
: new PollingOptions(pollingOptions);
|
|
229
|
+
return await this.pollForRagDocument(product, initialResponse, pollingOptionsInstance);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Not recommended for general use, prefer `updateAndGetRagAnnotationPoll`.
|
|
233
|
+
* You will need to poll until the document is ready for use.
|
|
234
|
+
* Update a document's annotations in the RAG database.
|
|
235
|
+
*
|
|
236
|
+
* @param product The product the RAG database belongs to.
|
|
237
|
+
* @param parameters The parameters to use for the update.
|
|
238
|
+
*/
|
|
239
|
+
async updateRagAnnotation(product, parameters) {
|
|
240
|
+
const paramsInstance = parameters instanceof product.annotationParametersClass
|
|
241
|
+
? parameters
|
|
242
|
+
: new product.annotationParametersClass(parameters);
|
|
243
|
+
logger.debug(`Updating RAG document ID: ${paramsInstance.documentId}`);
|
|
244
|
+
return await this.mindeeApi.reqPatchRagAnnotation(product, paramsInstance);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Update a document's annotations in the RAG database and poll until ready.
|
|
248
|
+
*
|
|
249
|
+
* @param product The product the RAG database belongs to.
|
|
250
|
+
* @param parameters The parameters to use for the update.
|
|
251
|
+
* @param pollingOptions options for the polling loop, see {@link PollingOptions}.
|
|
252
|
+
* @returns a `Promise` containing the RAG document annotation.
|
|
253
|
+
*/
|
|
254
|
+
async updateAndGetRagAnnotationPoll(product, parameters, pollingOptions) {
|
|
255
|
+
const initialResponse = await this.updateRagAnnotation(product, parameters);
|
|
256
|
+
if (initialResponse.status !== "Processing") {
|
|
257
|
+
return initialResponse;
|
|
258
|
+
}
|
|
259
|
+
const pollingOptionsInstance = pollingOptions instanceof PollingOptions
|
|
260
|
+
? pollingOptions
|
|
261
|
+
: new PollingOptions(pollingOptions);
|
|
262
|
+
return await this.pollForRagDocument(product, initialResponse, pollingOptionsInstance);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Deletes a document from the RAG database.
|
|
266
|
+
* @param product the product the RAG database belongs to.
|
|
267
|
+
* @param documentId the document's ID.
|
|
268
|
+
*/
|
|
269
|
+
async deleteRagDocument(product, documentId) {
|
|
270
|
+
return await this.mindeeApi.reqDeleteRagDocument(product, documentId);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Poll until the document is finished processing or the max number of attempts is reached.
|
|
274
|
+
*
|
|
275
|
+
* @param product The product the RAG database belongs to.
|
|
276
|
+
* @param initialResponse The initial response containing the document's ID.
|
|
277
|
+
* @param pollingOptions Options for the polling loop, see {@link PollingOptions}.
|
|
278
|
+
* @returns A `Promise` containing the RAG document annotation.
|
|
279
|
+
* @protected
|
|
280
|
+
*/
|
|
281
|
+
async pollForRagDocument(product, initialResponse, pollingOptions) {
|
|
282
|
+
logger.debug(`Polling for RAG document ID: ${initialResponse.id}`);
|
|
283
|
+
const maxRetries = pollingOptions.maxRetries + 1;
|
|
284
|
+
logger.debug(`Waiting ${pollingOptions.initialDelaySec} seconds before attempting to retrieve the result...`);
|
|
285
|
+
await setTimeout(pollingOptions.initialDelaySec * 1000, undefined, pollingOptions.initialTimerOptions);
|
|
286
|
+
const documentId = initialResponse.id;
|
|
287
|
+
let retryCount = 1;
|
|
288
|
+
while (retryCount < maxRetries) {
|
|
289
|
+
logger.debug(`Poll attempt ${retryCount} of ${pollingOptions.maxRetries}`);
|
|
290
|
+
const response = await this.getRagDocument(product, documentId);
|
|
291
|
+
retryCount++;
|
|
292
|
+
switch (response.status) {
|
|
293
|
+
case "Processing":
|
|
294
|
+
await setTimeout(pollingOptions.delaySec * 1000, undefined, pollingOptions.recurringTimerOptions);
|
|
295
|
+
continue;
|
|
296
|
+
case "Failed":
|
|
297
|
+
throw new MindeeError("RAG document failed without an error payload.");
|
|
298
|
+
default:
|
|
299
|
+
return response;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
throw new MindeeError(`RAG polling not complete after ${retryCount} attempts.`);
|
|
303
|
+
}
|
|
160
304
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constructor parameters for BaseAnnotationParameters and its subclasses.
|
|
3
|
+
*/
|
|
4
|
+
export interface BaseAnnotationParametersConstructor {
|
|
5
|
+
documentId: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Base parameters for document annotations.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class BaseAnnotationParameters {
|
|
11
|
+
/**
|
|
12
|
+
* UUID of the annotated document.
|
|
13
|
+
*/
|
|
14
|
+
readonly documentId: string;
|
|
15
|
+
/**
|
|
16
|
+
* Default constructor.
|
|
17
|
+
*/
|
|
18
|
+
protected constructor(params: BaseAnnotationParametersConstructor);
|
|
19
|
+
/**
|
|
20
|
+
* Gets the request parameters for the upload request.
|
|
21
|
+
*/
|
|
22
|
+
abstract getRequestParameters(): Record<string, string>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MindeeConfigurationError } from "../../errors/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Base parameters for document annotations.
|
|
4
|
+
*/
|
|
5
|
+
export class BaseAnnotationParameters {
|
|
6
|
+
/**
|
|
7
|
+
* Default constructor.
|
|
8
|
+
*/
|
|
9
|
+
constructor(params) {
|
|
10
|
+
const documentId = params.documentId?.trim();
|
|
11
|
+
if (!documentId) {
|
|
12
|
+
throw new MindeeConfigurationError("Document ID must be provided");
|
|
13
|
+
}
|
|
14
|
+
// Note: documentId is included in the request URL path, it is not a parameter.
|
|
15
|
+
this.documentId = documentId;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -4,10 +4,11 @@ import { MindeeConfigurationError } from "../../errors/index.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export class BaseProductParameters {
|
|
6
6
|
constructor(params) {
|
|
7
|
-
|
|
7
|
+
const modelId = params.modelId?.trim();
|
|
8
|
+
if (!modelId) {
|
|
8
9
|
throw new MindeeConfigurationError("Model ID must be provided");
|
|
9
10
|
}
|
|
10
|
-
this.modelId =
|
|
11
|
+
this.modelId = modelId;
|
|
11
12
|
this.alias = params.alias;
|
|
12
13
|
this.webhookIds = params.webhookIds;
|
|
13
14
|
this.closeFile = params.closeFile;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constructor parameters for BaseRagDocumentUploadParameters and its subclasses.
|
|
3
|
+
*/
|
|
4
|
+
export interface BaseRagDocumentUploadParametersConstructor {
|
|
5
|
+
modelId: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Base parameters for document upload operations.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class BaseRagDocumentUploadParameters {
|
|
11
|
+
/**
|
|
12
|
+
* UUID of the model that the uploaded RAG document is linked to.
|
|
13
|
+
*/
|
|
14
|
+
readonly modelId: string;
|
|
15
|
+
/**
|
|
16
|
+
* Default constructor.
|
|
17
|
+
*/
|
|
18
|
+
protected constructor(params: BaseRagDocumentUploadParametersConstructor);
|
|
19
|
+
/**
|
|
20
|
+
* Gets the request parameters for the upload request.
|
|
21
|
+
*/
|
|
22
|
+
getRequestParameters(): Record<string, string>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MindeeConfigurationError } from "../../errors/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Base parameters for document upload operations.
|
|
4
|
+
*/
|
|
5
|
+
export class BaseRagDocumentUploadParameters {
|
|
6
|
+
/**
|
|
7
|
+
* Default constructor.
|
|
8
|
+
*/
|
|
9
|
+
constructor(params) {
|
|
10
|
+
const modelId = params.modelId?.trim();
|
|
11
|
+
if (!modelId) {
|
|
12
|
+
throw new MindeeConfigurationError("Model ID must be provided");
|
|
13
|
+
}
|
|
14
|
+
this.modelId = modelId;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Gets the request parameters for the upload request.
|
|
18
|
+
*/
|
|
19
|
+
getRequestParameters() {
|
|
20
|
+
const parameters = {};
|
|
21
|
+
parameters["model_id"] = this.modelId;
|
|
22
|
+
return parameters;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -2,3 +2,5 @@ export { PollingOptions } from "./pollingOptions.js";
|
|
|
2
2
|
export type { PollingOptionsConstructor, TimerOptions, } from "./pollingOptions.js";
|
|
3
3
|
export { BaseProductParameters } from "./baseProductParameters.js";
|
|
4
4
|
export { BaseSearchParameters } from "./baseSearchParameters.js";
|
|
5
|
+
export { BaseRagDocumentUploadParameters } from "./baseRagDocumentUploadParameters.js";
|
|
6
|
+
export { BaseAnnotationParameters } from "./baseAnnotationParameters.js";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { PollingOptions } from "./pollingOptions.js";
|
|
2
2
|
export { BaseProductParameters } from "./baseProductParameters.js";
|
|
3
3
|
export { BaseSearchParameters } from "./baseSearchParameters.js";
|
|
4
|
+
export { BaseRagDocumentUploadParameters } from "./baseRagDocumentUploadParameters.js";
|
|
5
|
+
export { BaseAnnotationParameters } from "./baseAnnotationParameters.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LocalInputSource } from "../../input/index.js";
|
|
2
|
-
import { CropItem } from "
|
|
2
|
+
import { CropItem } from "../product/crop/index.js";
|
|
3
3
|
import { ExtractedImage, ExtractedImages } from "../../image/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* Extracts a single specified crop from a given input source.
|
package/src/v2/http/errors.d.ts
CHANGED