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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for annotated fields.
|
|
3
|
+
*/
|
|
4
|
+
export class AnnotatedBaseField {
|
|
5
|
+
/**
|
|
6
|
+
* Default constructor.
|
|
7
|
+
* @param selected When true, use the RAG information for the final result.
|
|
8
|
+
* When false, use the Data Schema information.
|
|
9
|
+
* @param guidelines Guidelines or instructions for processing this field.
|
|
10
|
+
*/
|
|
11
|
+
constructor(selected, guidelines = null) {
|
|
12
|
+
this.selected = selected;
|
|
13
|
+
this.guidelines = guidelines;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AnnotatedSimpleField } from "./annotatedSimpleField.js";
|
|
2
|
+
import { AnnotatedObjectField } from "./annotatedObjectField.js";
|
|
3
|
+
import { AnnotatedListField } from "./annotatedListField.js";
|
|
4
|
+
import { StringDict } from "../../../../parsing/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* A dictionary of field names and their corresponding configured field types.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AnnotatedFields extends Map<string, AnnotatedSimpleField | AnnotatedObjectField | AnnotatedListField> {
|
|
9
|
+
constructor(serverResponse: StringDict);
|
|
10
|
+
/**
|
|
11
|
+
* Returns a field as an `AnnotatedSimpleField`, or throws if the type mismatches.
|
|
12
|
+
*/
|
|
13
|
+
getSimpleField(fieldName: string): AnnotatedSimpleField;
|
|
14
|
+
/**
|
|
15
|
+
* Returns a field as an `AnnotatedObjectField`, or throws if the type mismatches.
|
|
16
|
+
*/
|
|
17
|
+
getObjectField(fieldName: string): AnnotatedObjectField;
|
|
18
|
+
/**
|
|
19
|
+
* Returns a field as an `AnnotatedListField`, or throws if the type mismatches.
|
|
20
|
+
*/
|
|
21
|
+
getListField(fieldName: string): AnnotatedListField;
|
|
22
|
+
/**
|
|
23
|
+
* Serializes the fields to API format.
|
|
24
|
+
* Needed because a `Map` is otherwise serialized as an empty object by `JSON.stringify`.
|
|
25
|
+
*/
|
|
26
|
+
toJSON(): Record<string, AnnotatedSimpleField | AnnotatedObjectField | AnnotatedListField>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createAnnotatedField } from "./fieldFactory.js";
|
|
2
|
+
/**
|
|
3
|
+
* A dictionary of field names and their corresponding configured field types.
|
|
4
|
+
*/
|
|
5
|
+
export class AnnotatedFields extends Map {
|
|
6
|
+
constructor(serverResponse) {
|
|
7
|
+
super(Object.entries(serverResponse).map(([key, value]) => {
|
|
8
|
+
return [key, createAnnotatedField(value)];
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns a field as an `AnnotatedSimpleField`, or throws if the type mismatches.
|
|
13
|
+
*/
|
|
14
|
+
getSimpleField(fieldName) {
|
|
15
|
+
const field = this.get(fieldName);
|
|
16
|
+
if (field === undefined) {
|
|
17
|
+
throw new Error(`The field '${fieldName}' was not found.`);
|
|
18
|
+
}
|
|
19
|
+
if (field.constructor.name !== "AnnotatedSimpleField") {
|
|
20
|
+
throw new Error(`The field '${fieldName}' is not a AnnotatedSimpleField.`);
|
|
21
|
+
}
|
|
22
|
+
return field;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns a field as an `AnnotatedObjectField`, or throws if the type mismatches.
|
|
26
|
+
*/
|
|
27
|
+
getObjectField(fieldName) {
|
|
28
|
+
const field = this.get(fieldName);
|
|
29
|
+
if (field === undefined) {
|
|
30
|
+
throw new Error(`The field '${fieldName}' was not found.`);
|
|
31
|
+
}
|
|
32
|
+
if (field.constructor.name !== "AnnotatedObjectField") {
|
|
33
|
+
throw new Error(`The field '${fieldName}' is not an ObjectField.`);
|
|
34
|
+
}
|
|
35
|
+
return field;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Returns a field as an `AnnotatedListField`, or throws if the type mismatches.
|
|
39
|
+
*/
|
|
40
|
+
getListField(fieldName) {
|
|
41
|
+
const field = this.get(fieldName);
|
|
42
|
+
if (field === undefined) {
|
|
43
|
+
throw new Error(`The field '${fieldName}' was not found.`);
|
|
44
|
+
}
|
|
45
|
+
if (field.constructor.name !== "AnnotatedListField") {
|
|
46
|
+
throw new Error(`The field '${fieldName}' is not a ListField.`);
|
|
47
|
+
}
|
|
48
|
+
return field;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Serializes the fields to API format.
|
|
52
|
+
* Needed because a `Map` is otherwise serialized as an empty object by `JSON.stringify`.
|
|
53
|
+
*/
|
|
54
|
+
toJSON() {
|
|
55
|
+
return Object.fromEntries(this);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { StringDict } from "../../../../parsing/stringDict.js";
|
|
2
|
+
import { AnnotatedBaseField } from "./annotatedBaseField.js";
|
|
3
|
+
import { AnnotatedObjectField } from "./annotatedObjectField.js";
|
|
4
|
+
import { AnnotatedSimpleField } from "./annotatedSimpleField.js";
|
|
5
|
+
/**
|
|
6
|
+
* Field having a list of fields.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AnnotatedListField extends AnnotatedBaseField {
|
|
9
|
+
/**
|
|
10
|
+
* Items contained in the list.
|
|
11
|
+
*/
|
|
12
|
+
items: Array<AnnotatedListField | AnnotatedObjectField | AnnotatedSimpleField>;
|
|
13
|
+
constructor(serverResponse: StringDict);
|
|
14
|
+
/**
|
|
15
|
+
* AnnotatedSimpleField items from the list.
|
|
16
|
+
*/
|
|
17
|
+
get simpleItems(): Array<AnnotatedSimpleField>;
|
|
18
|
+
/**
|
|
19
|
+
* AnnotatedObjectField items from the list.
|
|
20
|
+
*/
|
|
21
|
+
get objectItems(): Array<AnnotatedObjectField>;
|
|
22
|
+
/** Returns a readable representation of list items. */
|
|
23
|
+
toString(): string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { MindeeDeserializationError } from "../../../../errors/index.js";
|
|
2
|
+
import { AnnotatedBaseField } from "./annotatedBaseField.js";
|
|
3
|
+
import { AnnotatedObjectField } from "./annotatedObjectField.js";
|
|
4
|
+
import { AnnotatedSimpleField } from "./annotatedSimpleField.js";
|
|
5
|
+
import { createAnnotatedField } from "./fieldFactory.js";
|
|
6
|
+
/**
|
|
7
|
+
* Field having a list of fields.
|
|
8
|
+
*/
|
|
9
|
+
export class AnnotatedListField extends AnnotatedBaseField {
|
|
10
|
+
constructor(serverResponse) {
|
|
11
|
+
super(serverResponse["selected"], serverResponse["guidelines"]);
|
|
12
|
+
if (!Array.isArray(serverResponse["items"])) {
|
|
13
|
+
throw new MindeeDeserializationError(`Expected "items" to be an array in ${JSON.stringify(serverResponse)}.`);
|
|
14
|
+
}
|
|
15
|
+
this.items = serverResponse["items"].map((item) => {
|
|
16
|
+
return createAnnotatedField(item);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* AnnotatedSimpleField items from the list.
|
|
21
|
+
*/
|
|
22
|
+
get simpleItems() {
|
|
23
|
+
const result = [];
|
|
24
|
+
for (const item of this.items) {
|
|
25
|
+
if (item instanceof AnnotatedSimpleField) {
|
|
26
|
+
result.push(item);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
throw new MindeeDeserializationError(`All items must be AnnotatedSimpleField, found item of type ${item.constructor.name}.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* AnnotatedObjectField items from the list.
|
|
36
|
+
*/
|
|
37
|
+
get objectItems() {
|
|
38
|
+
const result = [];
|
|
39
|
+
for (const item of this.items) {
|
|
40
|
+
if (item instanceof AnnotatedObjectField) {
|
|
41
|
+
result.push(item);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
throw new MindeeDeserializationError(`All items must be AnnotatedObjectField, found item of type ${item.constructor.name}.`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
/** Returns a readable representation of list items. */
|
|
50
|
+
toString() {
|
|
51
|
+
if (!this.items || this.items.length === 0) {
|
|
52
|
+
return "\n";
|
|
53
|
+
}
|
|
54
|
+
const parts = [""];
|
|
55
|
+
for (const item of this.items) {
|
|
56
|
+
if (!item)
|
|
57
|
+
continue;
|
|
58
|
+
if (item instanceof AnnotatedObjectField) {
|
|
59
|
+
parts.push(item.toStringFromList());
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
parts.push(item.toString());
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return parts.join("\n * ");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AnnotatedBaseField } from "./annotatedBaseField.js";
|
|
2
|
+
import { StringDict } from "../../../../parsing/index.js";
|
|
3
|
+
import { AnnotatedFields } from "./annotatedFields.js";
|
|
4
|
+
import { AnnotatedSimpleField } from "./annotatedSimpleField.js";
|
|
5
|
+
import { AnnotatedListField } from "./annotatedListField.js";
|
|
6
|
+
/**
|
|
7
|
+
* Field having a set of sub-fields.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AnnotatedObjectField extends AnnotatedBaseField {
|
|
10
|
+
/**
|
|
11
|
+
* Nested fields carried by this object.
|
|
12
|
+
*/
|
|
13
|
+
readonly fields: AnnotatedFields;
|
|
14
|
+
constructor(serverResponse: StringDict);
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves a AnnotatedSimpleField by its name if it exists and is of the correct type.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} fieldName - The name of the field to retrieve.
|
|
19
|
+
* @return {AnnotatedSimpleField} The field instance if it exists and is valid, or undefined if not.
|
|
20
|
+
* @throws {Error} If the field does not exist or is of wrong type.
|
|
21
|
+
*/
|
|
22
|
+
getSimpleField(fieldName: string): AnnotatedSimpleField;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves a AnnotatedListField by its name if it exists and is of the correct type.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} fieldName - The name of the field to retrieve.
|
|
27
|
+
* @return {AnnotatedListField} The field instance if it exists and is valid, or undefined if not.
|
|
28
|
+
* @throws {Error} If the field does not exist or is of wrong type.
|
|
29
|
+
*/
|
|
30
|
+
getListField(fieldName: string): AnnotatedListField;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves an AnnotatedObjectField by its name if it exists and is of the correct type.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} fieldName - The name of the field to retrieve.
|
|
35
|
+
* @return {AnnotatedObjectField} The field instance if it exists and is valid, or undefined if not.
|
|
36
|
+
* @throws {Error} If the field does not exist or is of wrong type.
|
|
37
|
+
*/
|
|
38
|
+
getObjectField(fieldName: string): AnnotatedObjectField;
|
|
39
|
+
/**
|
|
40
|
+
* Returns a compact representation suitable for list items.
|
|
41
|
+
*/
|
|
42
|
+
toStringFromList(): string;
|
|
43
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AnnotatedBaseField } from "./annotatedBaseField.js";
|
|
2
|
+
import { AnnotatedFields } from "./annotatedFields.js";
|
|
3
|
+
/**
|
|
4
|
+
* Field having a set of sub-fields.
|
|
5
|
+
*/
|
|
6
|
+
export class AnnotatedObjectField extends AnnotatedBaseField {
|
|
7
|
+
constructor(serverResponse) {
|
|
8
|
+
super(serverResponse["selected"], serverResponse["guidelines"]);
|
|
9
|
+
this.fields = new AnnotatedFields(serverResponse["fields"]);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves a AnnotatedSimpleField by its name if it exists and is of the correct type.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} fieldName - The name of the field to retrieve.
|
|
15
|
+
* @return {AnnotatedSimpleField} The field instance if it exists and is valid, or undefined if not.
|
|
16
|
+
* @throws {Error} If the field does not exist or is of wrong type.
|
|
17
|
+
*/
|
|
18
|
+
getSimpleField(fieldName) {
|
|
19
|
+
return this.fields.getSimpleField(fieldName);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves a AnnotatedListField by its name if it exists and is of the correct type.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} fieldName - The name of the field to retrieve.
|
|
25
|
+
* @return {AnnotatedListField} The field instance if it exists and is valid, or undefined if not.
|
|
26
|
+
* @throws {Error} If the field does not exist or is of wrong type.
|
|
27
|
+
*/
|
|
28
|
+
getListField(fieldName) {
|
|
29
|
+
return this.fields.getListField(fieldName);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves an AnnotatedObjectField by its name if it exists and is of the correct type.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} fieldName - The name of the field to retrieve.
|
|
35
|
+
* @return {AnnotatedObjectField} The field instance if it exists and is valid, or undefined if not.
|
|
36
|
+
* @throws {Error} If the field does not exist or is of wrong type.
|
|
37
|
+
*/
|
|
38
|
+
getObjectField(fieldName) {
|
|
39
|
+
return this.fields.getObjectField(fieldName);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns a compact representation suitable for list items.
|
|
43
|
+
*/
|
|
44
|
+
toStringFromList() {
|
|
45
|
+
return this.fields ? this.fields.toString().substring(4) : "";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AnnotatedBaseField } from "./annotatedBaseField.js";
|
|
2
|
+
import { StringDict } from "../../../../parsing/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* A SimpleField with additional configuration for annotation.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AnnotatedSimpleField extends AnnotatedBaseField {
|
|
7
|
+
/**
|
|
8
|
+
* Field value, one of: string, boolean, number, null.
|
|
9
|
+
*/
|
|
10
|
+
value: string | boolean | number | null;
|
|
11
|
+
/**
|
|
12
|
+
* Default constructor.
|
|
13
|
+
*/
|
|
14
|
+
constructor(serverResponse: StringDict);
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AnnotatedBaseField } from "./annotatedBaseField.js";
|
|
2
|
+
/**
|
|
3
|
+
* A SimpleField with additional configuration for annotation.
|
|
4
|
+
*/
|
|
5
|
+
export class AnnotatedSimpleField extends AnnotatedBaseField {
|
|
6
|
+
/**
|
|
7
|
+
* Default constructor.
|
|
8
|
+
*/
|
|
9
|
+
constructor(serverResponse) {
|
|
10
|
+
super(serverResponse["selected"], serverResponse["guidelines"]);
|
|
11
|
+
this.value = serverResponse["value"];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseRagAnnotationResponse } from "../../../parsing/baseRagAnnotationResponse.js";
|
|
2
|
+
import { RagAnnotation } from "./ragAnnotation.js";
|
|
3
|
+
import { StringDict } from "../../../../parsing/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Response for a RAG document.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExtractionRagAnnotationResponse extends BaseRagAnnotationResponse {
|
|
8
|
+
/**
|
|
9
|
+
* Model identifier linked to the RAG document.
|
|
10
|
+
*/
|
|
11
|
+
modelId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Number of times this document was used in an inference.
|
|
14
|
+
*/
|
|
15
|
+
totalMatches: number;
|
|
16
|
+
/**
|
|
17
|
+
* Date and time of the latest matching inference, if any.
|
|
18
|
+
*/
|
|
19
|
+
lastMatchAt: Date | null;
|
|
20
|
+
/**
|
|
21
|
+
* Annotation metadata associated with the document.
|
|
22
|
+
*/
|
|
23
|
+
annotation: RagAnnotation | null;
|
|
24
|
+
constructor(serverResponse: StringDict);
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseRagAnnotationResponse } from "../../../parsing/baseRagAnnotationResponse.js";
|
|
2
|
+
import { RagAnnotation } from "./ragAnnotation.js";
|
|
3
|
+
import { parseDate } from "../../../../parsing/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Response for a RAG document.
|
|
6
|
+
*/
|
|
7
|
+
export class ExtractionRagAnnotationResponse extends BaseRagAnnotationResponse {
|
|
8
|
+
constructor(serverResponse) {
|
|
9
|
+
super(serverResponse);
|
|
10
|
+
this.modelId = serverResponse["model_id"];
|
|
11
|
+
this.totalMatches = serverResponse["total_matches"];
|
|
12
|
+
this.lastMatchAt = parseDate(serverResponse["last_match_at"]);
|
|
13
|
+
this.annotation = serverResponse["annotation"]
|
|
14
|
+
? new RagAnnotation(serverResponse["annotation"])
|
|
15
|
+
: null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factory helper.
|
|
3
|
+
*/
|
|
4
|
+
import { StringDict } from "../../../../parsing/stringDict.js";
|
|
5
|
+
import { AnnotatedListField } from "./annotatedListField.js";
|
|
6
|
+
import { AnnotatedObjectField } from "./annotatedObjectField.js";
|
|
7
|
+
import { AnnotatedSimpleField } from "./annotatedSimpleField.js";
|
|
8
|
+
/**
|
|
9
|
+
* Create an annotated field from a server response.
|
|
10
|
+
* @param serverResponse Server response.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createAnnotatedField(serverResponse: StringDict): AnnotatedSimpleField | AnnotatedListField | AnnotatedObjectField;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MindeeDeserializationError } from "../../../../errors/index.js";
|
|
2
|
+
import { AnnotatedListField } from "./annotatedListField.js";
|
|
3
|
+
import { AnnotatedObjectField } from "./annotatedObjectField.js";
|
|
4
|
+
import { AnnotatedSimpleField } from "./annotatedSimpleField.js";
|
|
5
|
+
/**
|
|
6
|
+
* Create an annotated field from a server response.
|
|
7
|
+
* @param serverResponse Server response.
|
|
8
|
+
*/
|
|
9
|
+
export function createAnnotatedField(serverResponse) {
|
|
10
|
+
if (typeof serverResponse !== "object" || serverResponse === null) {
|
|
11
|
+
throw new MindeeDeserializationError(`Unrecognized field format ${JSON.stringify(serverResponse)}.`);
|
|
12
|
+
}
|
|
13
|
+
if ("items" in serverResponse) {
|
|
14
|
+
return new AnnotatedListField(serverResponse);
|
|
15
|
+
}
|
|
16
|
+
if ("fields" in serverResponse) {
|
|
17
|
+
return new AnnotatedObjectField(serverResponse);
|
|
18
|
+
}
|
|
19
|
+
if ("value" in serverResponse) {
|
|
20
|
+
return new AnnotatedSimpleField(serverResponse);
|
|
21
|
+
}
|
|
22
|
+
throw new MindeeDeserializationError(`Unrecognized field format in ${JSON.stringify(serverResponse)}.`);
|
|
23
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ExtractionRagAnnotationResponse } from "./extractionRagAnnotationResponse.js";
|
|
2
|
+
export { RagAnnotation } from "./ragAnnotation.js";
|
|
3
|
+
export { AnnotatedFields } from "./annotatedFields.js";
|
|
4
|
+
export { AnnotatedSimpleField } from "./annotatedSimpleField.js";
|
|
5
|
+
export { AnnotatedListField } from "./annotatedListField.js";
|
|
6
|
+
export { AnnotatedObjectField } from "./annotatedObjectField.js";
|
|
7
|
+
export * as params from "./params/index.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ExtractionRagAnnotationResponse } from "./extractionRagAnnotationResponse.js";
|
|
2
|
+
export { RagAnnotation } from "./ragAnnotation.js";
|
|
3
|
+
export { AnnotatedFields } from "./annotatedFields.js";
|
|
4
|
+
export { AnnotatedSimpleField } from "./annotatedSimpleField.js";
|
|
5
|
+
export { AnnotatedListField } from "./annotatedListField.js";
|
|
6
|
+
export { AnnotatedObjectField } from "./annotatedObjectField.js";
|
|
7
|
+
export * as params from "./params/index.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseAnnotationParameters } from "../../../../clientOptions/baseAnnotationParameters.js";
|
|
2
|
+
import { RagAnnotation } from "../ragAnnotation.js";
|
|
3
|
+
import { BaseAnnotationParametersConstructor } from "../../../../clientOptions/baseAnnotationParameters.js";
|
|
4
|
+
/**
|
|
5
|
+
* Annotation parameters for RAG documents.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RagDocumentAnnotationParameters extends BaseAnnotationParameters {
|
|
8
|
+
/**
|
|
9
|
+
* New public status to apply to the document (for example, to deactivate it).
|
|
10
|
+
*/
|
|
11
|
+
readonly status?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Field-level RAG annotation and guidelines configuration for the document.
|
|
14
|
+
*/
|
|
15
|
+
readonly annotation?: RagAnnotation | null;
|
|
16
|
+
/**
|
|
17
|
+
* Default constructor.
|
|
18
|
+
*/
|
|
19
|
+
constructor(params: BaseAnnotationParametersConstructor & {
|
|
20
|
+
status?: string;
|
|
21
|
+
annotation?: RagAnnotation | string | Record<string, any> | null;
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Gets the request parameters for the upload request.
|
|
25
|
+
*/
|
|
26
|
+
getRequestParameters(): Record<string, any>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BaseAnnotationParameters } from "../../../../clientOptions/baseAnnotationParameters.js";
|
|
2
|
+
import { RagAnnotation } from "../ragAnnotation.js";
|
|
3
|
+
/**
|
|
4
|
+
* Annotation parameters for RAG documents.
|
|
5
|
+
*/
|
|
6
|
+
export class RagDocumentAnnotationParameters extends BaseAnnotationParameters {
|
|
7
|
+
/**
|
|
8
|
+
* Default constructor.
|
|
9
|
+
*/
|
|
10
|
+
constructor(params) {
|
|
11
|
+
super({ ...params });
|
|
12
|
+
this.status = params.status;
|
|
13
|
+
if (params.annotation === null || params.annotation === undefined) {
|
|
14
|
+
this.annotation = null;
|
|
15
|
+
}
|
|
16
|
+
else if (params.annotation instanceof RagAnnotation) {
|
|
17
|
+
this.annotation = params.annotation;
|
|
18
|
+
}
|
|
19
|
+
else if (typeof params.annotation === "string") {
|
|
20
|
+
const parsedJson = JSON.parse(params.annotation);
|
|
21
|
+
this.annotation = new RagAnnotation(parsedJson);
|
|
22
|
+
}
|
|
23
|
+
else if (typeof params.annotation === "object" && !Array.isArray(params.annotation)) {
|
|
24
|
+
this.annotation = new RagAnnotation(params.annotation);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
throw new Error("Invalid RAG Annotation format.");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets the request parameters for the upload request.
|
|
32
|
+
*/
|
|
33
|
+
getRequestParameters() {
|
|
34
|
+
const parameters = {};
|
|
35
|
+
if (this.status) {
|
|
36
|
+
parameters["status"] = this.status;
|
|
37
|
+
}
|
|
38
|
+
if (this.annotation) {
|
|
39
|
+
parameters["annotation"] = this.annotation;
|
|
40
|
+
}
|
|
41
|
+
return parameters;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseRagDocumentUploadParameters, BaseRagDocumentUploadParametersConstructor } from "../../../../clientOptions/baseRagDocumentUploadParameters.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for uploading a file to an extraction RAG database.
|
|
4
|
+
*/
|
|
5
|
+
export declare class RagDocumentUploadParameters extends BaseRagDocumentUploadParameters {
|
|
6
|
+
constructor(params: BaseRagDocumentUploadParametersConstructor & {});
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseRagDocumentUploadParameters } from "../../../../clientOptions/baseRagDocumentUploadParameters.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for uploading a file to an extraction RAG database.
|
|
4
|
+
*/
|
|
5
|
+
export class RagDocumentUploadParameters extends BaseRagDocumentUploadParameters {
|
|
6
|
+
constructor(params) {
|
|
7
|
+
super({ ...params });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AnnotatedFields } from "./annotatedFields.js";
|
|
2
|
+
import { StringDict } from "../../../../parsing/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* A RAG annotation enriched with field-level configuration.
|
|
5
|
+
*/
|
|
6
|
+
export declare class RagAnnotation {
|
|
7
|
+
/**
|
|
8
|
+
* A dictionary of field names and their corresponding configured field types.
|
|
9
|
+
*/
|
|
10
|
+
fields: AnnotatedFields;
|
|
11
|
+
constructor(serverResponse: StringDict);
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AnnotatedFields } from "./annotatedFields.js";
|
|
2
|
+
/**
|
|
3
|
+
* A RAG annotation enriched with field-level configuration.
|
|
4
|
+
*/
|
|
5
|
+
export class RagAnnotation {
|
|
6
|
+
constructor(serverResponse) {
|
|
7
|
+
this.fields = new AnnotatedFields(serverResponse["fields"] ?? {});
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OcrResponse } from "./ocrResponse.js";
|
|
2
2
|
import { OcrParameters } from "./params/index.js";
|
|
3
|
-
import { BaseProduct } from "
|
|
3
|
+
import { BaseProduct } from "../baseProduct.js";
|
|
4
4
|
/**
|
|
5
5
|
* Extract raw text (OCR) from any image or scanned document.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OcrResponse } from "./ocrResponse.js";
|
|
2
2
|
import { OcrParameters } from "./params/index.js";
|
|
3
|
-
import { BaseProduct } from "
|
|
3
|
+
import { BaseProduct } from "../baseProduct.js";
|
|
4
4
|
/**
|
|
5
5
|
* Extract raw text (OCR) from any image or scanned document.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StringDict } from "../../../parsing/index.js";
|
|
2
|
-
import { BaseInference } from "
|
|
3
|
-
import { OcrResult } from "
|
|
2
|
+
import { BaseInference } from "../../parsing/inference/baseInference.js";
|
|
3
|
+
import { OcrResult } from "./ocrResult.js";
|
|
4
4
|
/** Inference payload for OCR responses. */
|
|
5
5
|
export declare class OcrInference extends BaseInference {
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseInference } from "
|
|
2
|
-
import { OcrResult } from "
|
|
1
|
+
import { BaseInference } from "../../parsing/inference/baseInference.js";
|
|
2
|
+
import { OcrResult } from "./ocrResult.js";
|
|
3
3
|
/** Inference payload for OCR responses. */
|
|
4
4
|
export class OcrInference extends BaseInference {
|
|
5
5
|
constructor(serverResponse) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StringDict } from "../../../parsing/stringDict.js";
|
|
2
2
|
import { OcrInference } from "./ocrInference.js";
|
|
3
|
-
import { BaseResponse } from "
|
|
3
|
+
import { BaseResponse } from "../../parsing/index.js";
|
|
4
4
|
/** Response wrapper for OCR product calls. */
|
|
5
5
|
export declare class OcrResponse extends BaseResponse {
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OcrInference } from "./ocrInference.js";
|
|
2
|
-
import { BaseResponse } from "
|
|
2
|
+
import { BaseResponse } from "../../parsing/index.js";
|
|
3
3
|
/** Response wrapper for OCR product calls. */
|
|
4
4
|
export class OcrResponse extends BaseResponse {
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseProductParameters, BaseProductParametersConstructor } from "
|
|
1
|
+
import { BaseProductParameters, BaseProductParametersConstructor } from "../../../clientOptions/baseProductParameters.js";
|
|
2
2
|
/**
|
|
3
3
|
* Parameters for sending a file to a Raw Text (OCR) product.
|
|
4
4
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseProductParameters } from "
|
|
1
|
+
import { BaseProductParameters } from "../../../clientOptions/baseProductParameters.js";
|
|
2
2
|
import { logger } from "../../../../logger.js";
|
|
3
3
|
/**
|
|
4
4
|
* Parameters for sending a file to a Raw Text (OCR) product.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseProductParameters, BaseProductParametersConstructor } from "
|
|
1
|
+
import { BaseProductParameters, BaseProductParametersConstructor } from "../../../clientOptions/baseProductParameters.js";
|
|
2
2
|
/**
|
|
3
3
|
* Parameters for sending a file to a Split product.
|
|
4
4
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseProductParameters, } from "
|
|
1
|
+
import { BaseProductParameters, } from "../../../clientOptions/baseProductParameters.js";
|
|
2
2
|
import { logger } from "../../../../logger.js";
|
|
3
3
|
/**
|
|
4
4
|
* Parameters for sending a file to a Split product.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SplitResponse } from "./splitResponse.js";
|
|
2
2
|
import { SplitParameters } from "./params/index.js";
|
|
3
|
-
import { BaseProduct } from "
|
|
3
|
+
import { BaseProduct } from "../baseProduct.js";
|
|
4
4
|
/**
|
|
5
5
|
* Break a multipage source file into separate documents, associating a class for each one.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SplitResponse } from "./splitResponse.js";
|
|
2
2
|
import { SplitParameters } from "./params/index.js";
|
|
3
|
-
import { BaseProduct } from "
|
|
3
|
+
import { BaseProduct } from "../baseProduct.js";
|
|
4
4
|
/**
|
|
5
5
|
* Break a multipage source file into separate documents, associating a class for each one.
|
|
6
6
|
*/
|