mindee 5.4.0 → 5.6.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 +24 -2
- package/package.json +26 -14
- package/src/geometry/bbox.d.ts +5 -0
- package/src/geometry/bbox.js +1 -0
- package/src/geometry/minMax.d.ts +3 -0
- package/src/geometry/polygonUtils.d.ts +23 -0
- package/src/geometry/polygonUtils.js +23 -0
- package/src/http/apiCore.d.ts +1 -0
- package/src/http/apiCore.js +21 -3
- package/src/http/baseSettings.d.ts +5 -0
- package/src/http/baseSettings.js +2 -0
- package/src/image/extractedImage.d.ts +9 -5
- package/src/image/extractedImage.js +2 -2
- package/src/image/extractedImages.d.ts +1 -0
- package/src/image/extractedImages.js +1 -0
- package/src/image/imageCompressor.d.ts +1 -1
- package/src/image/imageExtractor.d.ts +7 -8
- package/src/image/imageExtractor.js +74 -75
- package/src/input/base64Input.d.ts +3 -0
- package/src/input/base64Input.js +3 -0
- package/src/input/bufferInput.d.ts +2 -0
- package/src/input/bufferInput.js +2 -0
- package/src/input/bytesInput.d.ts +3 -0
- package/src/input/bytesInput.js +3 -0
- package/src/input/inputSource.d.ts +15 -0
- package/src/input/inputSource.js +15 -0
- package/src/input/localInputSource.d.ts +6 -0
- package/src/input/localInputSource.js +3 -0
- package/src/input/pathInput.d.ts +4 -0
- package/src/input/pathInput.js +3 -0
- package/src/input/streamInput.d.ts +4 -0
- package/src/input/streamInput.js +4 -0
- package/src/input/urlInput.d.ts +12 -0
- package/src/input/urlInput.js +52 -10
- package/src/logger.js +1 -1
- package/src/parsing/dateParser.d.ts +4 -0
- package/src/parsing/dateParser.js +5 -1
- package/src/parsing/localResponseBase.d.ts +2 -0
- package/src/parsing/localResponseBase.js +2 -0
- package/src/parsing/stringDict.d.ts +1 -0
- package/src/pdf/extractedPdf.d.ts +8 -2
- package/src/pdf/extractedPdf.js +5 -3
- package/src/pdf/extractedPdfs.d.ts +1 -0
- package/src/pdf/extractedPdfs.js +1 -0
- package/src/pdf/pdfCompressor.js +12 -0
- package/src/pdf/pdfExtractor.d.ts +2 -2
- package/src/pdf/pdfExtractor.js +4 -1
- package/src/pdf/pdfOperation.d.ts +3 -0
- package/src/pdf/pdfOperation.js +3 -0
- package/src/pdf/pdfUtils.js +5 -0
- package/src/v1/cli.d.ts +3 -0
- package/src/v1/cli.js +84 -26
- package/src/v1/client.d.ts +16 -16
- package/src/v1/extraction/invoiceSplitterExtractor/extractedInvoiceSplitterImage.d.ts +5 -3
- package/src/v1/extraction/invoiceSplitterExtractor/extractedInvoiceSplitterImage.js +4 -4
- package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.js +14 -0
- package/src/v1/extraction/multiReceiptsExtractor/extractedMultiReceiptImage.d.ts +2 -0
- package/src/v1/extraction/multiReceiptsExtractor/extractedMultiReceiptImage.js +1 -1
- package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.js +3 -0
- package/src/v1/http/apiSettingsV1.d.ts +5 -0
- package/src/v1/http/apiSettingsV1.js +4 -0
- package/src/v1/http/errors.d.ts +7 -1
- package/src/v1/http/errors.js +65 -86
- package/src/v1/http/httpParams.d.ts +12 -0
- package/src/v1/parsing/common/asyncPredictResponse.d.ts +4 -0
- package/src/v1/parsing/common/asyncPredictResponse.js +5 -2
- package/src/v1/parsing/common/executionPriority.d.ts +4 -0
- package/src/v1/parsing/common/executionPriority.js +4 -0
- package/src/v1/parsing/common/extras/cropperExtra.d.ts +2 -0
- package/src/v1/parsing/common/extras/cropperExtra.js +3 -0
- package/src/v1/parsing/common/extras/extras.d.ts +3 -0
- package/src/v1/parsing/common/extras/extras.js +2 -0
- package/src/v1/parsing/common/extras/fullTextOcrExtra.d.ts +3 -0
- package/src/v1/parsing/common/extras/fullTextOcrExtra.js +1 -0
- package/src/v1/parsing/common/extras/ragExtra.d.ts +1 -0
- package/src/v1/parsing/common/extras/ragExtra.js +1 -0
- package/src/v1/parsing/common/feedback/feedbackResponse.js +1 -0
- package/src/v1/parsing/common/index.d.ts +1 -1
- package/src/v1/parsing/common/index.js +1 -1
- package/src/v1/parsing/common/inference.d.ts +2 -0
- package/src/v1/parsing/common/inference.js +2 -0
- package/src/v1/parsing/common/prediction.d.ts +1 -0
- package/src/v1/parsing/common/prediction.js +1 -0
- package/src/v1/parsing/common/summaryHelper.d.ts +12 -1
- package/src/v1/parsing/common/summaryHelper.js +18 -1
- package/src/v1/parsing/generated/generatedObject.d.ts +6 -0
- package/src/v1/parsing/generated/generatedObject.js +38 -27
- package/src/v1/parsing/localResponse.d.ts +1 -0
- package/src/v1/parsing/localResponse.js +1 -0
- package/src/v1/parsing/standard/base.d.ts +6 -0
- package/src/v1/parsing/standard/base.js +1 -0
- package/src/v1/parsing/standard/boolean.d.ts +1 -1
- package/src/v1/parsing/standard/companyRegistration.d.ts +1 -0
- package/src/v1/parsing/standard/companyRegistration.js +1 -0
- package/src/v1/parsing/standard/date.d.ts +1 -0
- package/src/v1/parsing/standard/date.js +1 -0
- package/src/v1/parsing/standard/paymentDetails.d.ts +5 -5
- package/src/v1/parsing/standard/position.d.ts +2 -2
- package/src/v1/parsing/standard/tax.d.ts +1 -0
- package/src/v1/parsing/standard/tax.js +1 -0
- package/src/v1/parsing/standard/text.d.ts +1 -1
- package/src/v1/parsing/standard/word.d.ts +3 -0
- package/src/v1/parsing/standard/word.js +1 -0
- package/src/v1/product/financialDocument/financialDocumentV1LineItem.js +16 -58
- package/src/v1/product/generated/generatedV1Prediction.d.ts +1 -0
- package/src/v1/product/generated/generatedV1Prediction.js +2 -1
- package/src/v1/product/invoice/invoiceV4LineItem.js +5 -16
- package/src/v1/product/receipt/receiptV5LineItem.js +2 -6
- package/src/v1/product/resume/resumeV1Certificate.js +5 -21
- package/src/v1/product/resume/resumeV1Education.js +8 -36
- package/src/v1/product/resume/resumeV1Language.js +3 -11
- package/src/v1/product/resume/resumeV1ProfessionalExperience.js +10 -46
- package/src/v1/product/resume/resumeV1SocialNetworksUrl.js +3 -11
- package/src/v2/cli.d.ts +3 -0
- package/src/v2/cli.js +21 -0
- package/src/v2/client.d.ts +10 -1
- package/src/v2/client.js +18 -8
- package/src/v2/clientOptions/baseParameters.d.ts +3 -2
- package/src/v2/clientOptions/pollingOptions.d.ts +6 -1
- package/src/v2/clientOptions/pollingOptions.js +4 -2
- package/src/v2/fileOperations/crop.js +1 -3
- package/src/v2/fileOperations/split.js +1 -1
- package/src/v2/http/mindeeApiV2.d.ts +23 -10
- package/src/v2/http/mindeeApiV2.js +79 -68
- package/src/v2/parsing/baseResponse.d.ts +2 -0
- package/src/v2/parsing/baseResponse.js +1 -0
- package/src/v2/parsing/error/errorDetails.d.ts +1 -0
- package/src/v2/parsing/index.d.ts +1 -1
- package/src/v2/parsing/index.js +1 -1
- package/src/v2/parsing/inference/baseInference.d.ts +2 -0
- package/src/v2/parsing/inference/baseInference.js +2 -0
- package/src/v2/parsing/inference/failedInferenceResponse.d.ts +33 -0
- package/src/v2/parsing/inference/failedInferenceResponse.js +17 -0
- package/src/v2/parsing/inference/field/baseField.d.ts +3 -0
- package/src/v2/parsing/inference/field/fieldConfidence.d.ts +4 -0
- package/src/v2/parsing/inference/field/fieldConfidence.js +4 -0
- package/src/v2/parsing/inference/field/fieldFactory.d.ts +5 -0
- package/src/v2/parsing/inference/field/fieldFactory.js +5 -0
- package/src/v2/parsing/inference/field/fieldLocation.d.ts +1 -0
- package/src/v2/parsing/inference/field/fieldLocation.js +1 -0
- package/src/v2/parsing/inference/field/inferenceFields.d.ts +5 -0
- package/src/v2/parsing/inference/field/inferenceFields.js +4 -0
- package/src/v2/parsing/inference/field/listField.d.ts +2 -0
- package/src/v2/parsing/inference/field/listField.js +2 -0
- package/src/v2/parsing/inference/field/objectField.d.ts +4 -0
- package/src/v2/parsing/inference/field/objectField.js +3 -0
- package/src/v2/parsing/inference/field/ragMetadata.d.ts +1 -0
- package/src/v2/parsing/inference/field/ragMetadata.js +1 -0
- package/src/v2/parsing/inference/field/rawText.d.ts +2 -0
- package/src/v2/parsing/inference/field/rawText.js +2 -0
- package/src/v2/parsing/inference/field/simpleField.d.ts +2 -0
- package/src/v2/parsing/inference/field/simpleField.js +2 -0
- package/src/v2/parsing/inference/inferenceFile.d.ts +2 -0
- package/src/v2/parsing/inference/inferenceFile.js +2 -0
- package/src/v2/parsing/inference/inferenceModel.d.ts +2 -0
- package/src/v2/parsing/inference/inferenceModel.js +2 -0
- package/src/v2/parsing/job/job.d.ts +1 -1
- package/src/v2/parsing/job/job.js +1 -3
- package/src/v2/parsing/job/jobResponse.d.ts +3 -0
- package/src/v2/parsing/job/jobResponse.js +3 -0
- package/src/v2/parsing/search/index.d.ts +4 -0
- package/src/v2/parsing/search/index.js +4 -0
- package/src/v2/parsing/search/modelWebhook.d.ts +19 -0
- package/src/v2/parsing/search/modelWebhook.js +10 -0
- package/src/v2/parsing/search/paginationMetadata.d.ts +24 -0
- package/src/v2/parsing/search/paginationMetadata.js +19 -0
- package/src/v2/parsing/search/searchModel.d.ts +25 -0
- package/src/v2/parsing/search/searchModel.js +19 -0
- package/src/v2/parsing/search/searchResponse.d.ts +19 -0
- package/src/v2/parsing/search/searchResponse.js +24 -0
- package/src/v2/product/classification/classification.d.ts +3 -0
- package/src/v2/product/classification/classification.js +3 -0
- package/src/v2/product/classification/classificationClassifier.d.ts +2 -0
- package/src/v2/product/classification/classificationClassifier.js +2 -0
- package/src/v2/product/classification/classificationInference.d.ts +2 -0
- package/src/v2/product/classification/classificationInference.js +2 -0
- package/src/v2/product/classification/classificationResponse.d.ts +1 -0
- package/src/v2/product/classification/classificationResponse.js +1 -0
- package/src/v2/product/classification/classificationResult.d.ts +2 -0
- package/src/v2/product/classification/classificationResult.js +2 -0
- package/src/v2/product/crop/crop.d.ts +3 -0
- package/src/v2/product/crop/crop.js +3 -0
- package/src/v2/product/crop/cropInference.d.ts +2 -0
- package/src/v2/product/crop/cropInference.js +2 -0
- package/src/v2/product/crop/cropItem.d.ts +2 -0
- package/src/v2/product/crop/cropItem.js +2 -0
- package/src/v2/product/crop/cropResponse.d.ts +1 -0
- package/src/v2/product/crop/cropResponse.js +1 -0
- package/src/v2/product/crop/cropResult.d.ts +2 -0
- package/src/v2/product/crop/cropResult.js +2 -0
- package/src/v2/product/extraction/dataSchemaActiveOption.d.ts +1 -0
- package/src/v2/product/extraction/dataSchemaActiveOption.js +1 -0
- package/src/v2/product/extraction/extraction.d.ts +3 -0
- package/src/v2/product/extraction/extraction.js +3 -0
- package/src/v2/product/extraction/extractionActiveOptions.d.ts +2 -0
- package/src/v2/product/extraction/extractionActiveOptions.js +2 -0
- package/src/v2/product/extraction/extractionInference.d.ts +2 -0
- package/src/v2/product/extraction/extractionInference.js +2 -0
- package/src/v2/product/extraction/extractionResponse.d.ts +1 -0
- package/src/v2/product/extraction/extractionResponse.js +1 -0
- package/src/v2/product/extraction/extractionResult.d.ts +2 -0
- package/src/v2/product/extraction/extractionResult.js +2 -0
- package/src/v2/product/extraction/params/dataSchema.d.ts +9 -6
- package/src/v2/product/extraction/params/dataSchema.js +2 -0
- package/src/v2/product/extraction/params/dataSchemaField.d.ts +25 -1
- package/src/v2/product/extraction/params/dataSchemaField.js +3 -0
- package/src/v2/product/extraction/params/dataSchemaReplace.d.ts +9 -4
- package/src/v2/product/extraction/params/dataSchemaReplace.js +2 -0
- package/src/v2/product/ocr/ocr.d.ts +3 -0
- package/src/v2/product/ocr/ocr.js +3 -0
- package/src/v2/product/ocr/ocrInference.d.ts +2 -0
- package/src/v2/product/ocr/ocrInference.js +2 -0
- package/src/v2/product/ocr/ocrPage.d.ts +2 -0
- package/src/v2/product/ocr/ocrPage.js +2 -0
- package/src/v2/product/ocr/ocrResponse.d.ts +1 -0
- package/src/v2/product/ocr/ocrResponse.js +1 -0
- package/src/v2/product/ocr/ocrResult.d.ts +1 -0
- package/src/v2/product/ocr/ocrResult.js +1 -0
- package/src/v2/product/ocr/ocrWord.d.ts +2 -0
- package/src/v2/product/ocr/ocrWord.js +2 -0
- package/src/v2/product/split/split.d.ts +3 -0
- package/src/v2/product/split/split.js +3 -0
- package/src/v2/product/split/splitInference.d.ts +2 -0
- package/src/v2/product/split/splitInference.js +2 -0
- package/src/v2/product/split/splitRange.d.ts +1 -0
- package/src/v2/product/split/splitRange.js +1 -0
- package/src/v2/product/split/splitResponse.d.ts +1 -0
- package/src/v2/product/split/splitResponse.js +1 -0
- package/src/v2/product/split/splitResult.d.ts +1 -0
- package/src/v2/product/split/splitResult.js +1 -0
|
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _MindeeApiV2_instances, _MindeeApiV2_processResponse
|
|
6
|
+
var _MindeeApiV2_instances, _MindeeApiV2_processResponse;
|
|
7
7
|
import { ApiSettings } from "./apiSettings.js";
|
|
8
8
|
import { ErrorResponse, JobResponse, } from "../../v2/parsing/index.js";
|
|
9
9
|
import { sendRequestAndReadResponse } from "../../http/apiCore.js";
|
|
@@ -11,6 +11,7 @@ import { LocalInputSource } from "../../input/index.js";
|
|
|
11
11
|
import { MindeeDeserializationError, MindeeError } from "../../errors/index.js";
|
|
12
12
|
import { MindeeHttpErrorV2 } from "./errors.js";
|
|
13
13
|
import { logger } from "../../logger.js";
|
|
14
|
+
import { SearchResponse } from "../../v2/parsing/search/index.js";
|
|
14
15
|
/**
|
|
15
16
|
* Mindee V2 API handler.
|
|
16
17
|
*/
|
|
@@ -20,29 +21,82 @@ export class MindeeApiV2 {
|
|
|
20
21
|
this.settings = new ApiSettings({ dispatcher: dispatcher, apiKey: apiKey });
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
24
|
+
* Search for models available to the account.
|
|
25
|
+
* @param name Optional name filter.
|
|
26
|
+
* @param modelType Optional model type filter.
|
|
27
|
+
* @returns a `Promise` containing the search response.
|
|
28
|
+
*/
|
|
29
|
+
async reqGetSearchModel(name, modelType) {
|
|
30
|
+
const queryParams = {};
|
|
31
|
+
if (name)
|
|
32
|
+
queryParams["name"] = name;
|
|
33
|
+
if (modelType)
|
|
34
|
+
queryParams["model_type"] = modelType;
|
|
35
|
+
const options = {
|
|
36
|
+
method: "GET",
|
|
37
|
+
headers: this.settings.baseHeaders,
|
|
38
|
+
hostname: this.settings.hostname,
|
|
39
|
+
path: "/v2/search/models",
|
|
40
|
+
queryParams: queryParams,
|
|
41
|
+
timeoutSecs: this.settings.timeoutSecs,
|
|
42
|
+
};
|
|
43
|
+
const response = await sendRequestAndReadResponse(this.settings.dispatcher, options);
|
|
44
|
+
return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, response, SearchResponse);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Sends a document to the inference queue.
|
|
48
|
+
* @param product Product to enqueue.
|
|
49
|
+
* @param inputSource Local or remote file as an input.
|
|
26
50
|
* @param params {ExtractionParameters} parameters relating to the enqueueing options.
|
|
27
|
-
* @throws Error if the server's response contains an error.
|
|
28
|
-
* @returns a `Promise` containing a job response.
|
|
29
51
|
*/
|
|
30
|
-
async
|
|
31
|
-
|
|
32
|
-
|
|
52
|
+
async reqPostProductEnqueue(product, inputSource, params) {
|
|
53
|
+
const form = params.getFormData();
|
|
54
|
+
if (inputSource instanceof LocalInputSource) {
|
|
55
|
+
form.set("file", new Blob([inputSource.fileObject]), inputSource.filename);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
form.set("url", inputSource.url);
|
|
59
|
+
}
|
|
60
|
+
const path = `/v2/products/${product.slug}/enqueue`;
|
|
61
|
+
const options = {
|
|
62
|
+
method: "POST",
|
|
63
|
+
headers: this.settings.baseHeaders,
|
|
64
|
+
hostname: this.settings.hostname,
|
|
65
|
+
path: path,
|
|
66
|
+
body: form,
|
|
67
|
+
timeoutSecs: this.settings.timeoutSecs,
|
|
68
|
+
};
|
|
69
|
+
const result = await sendRequestAndReadResponse(this.settings.dispatcher, options);
|
|
33
70
|
if (result.data.error !== undefined) {
|
|
34
71
|
throw new MindeeHttpErrorV2(result.data.error);
|
|
35
72
|
}
|
|
36
73
|
return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, result, JobResponse);
|
|
37
74
|
}
|
|
38
75
|
/**
|
|
39
|
-
* Get the specified Job.
|
|
76
|
+
* Get the specified Job by its ID.
|
|
40
77
|
* Throws an error if the server's response contains an error.
|
|
41
78
|
* @param jobId The Job ID as returned by the enqueue request.
|
|
42
79
|
* @returns a `Promise` containing the job response.
|
|
43
80
|
*/
|
|
44
|
-
async
|
|
45
|
-
|
|
81
|
+
async reqGetJobById(jobId) {
|
|
82
|
+
return this.reqGetJobByUrl(`https://${this.settings.hostname}/v2/jobs/${jobId}`);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get the specified Job from a polling URL.
|
|
86
|
+
* Throws an error if the server's response contains an error.
|
|
87
|
+
* @param pollingUrl The polling URL as returned by a Job's pollingUrl property.
|
|
88
|
+
* @returns a `Promise` containing the job response.
|
|
89
|
+
*/
|
|
90
|
+
async reqGetJobByUrl(pollingUrl) {
|
|
91
|
+
if (!pollingUrl.startsWith("https://")) {
|
|
92
|
+
throw new MindeeError(`Invalid URL: ${pollingUrl}`);
|
|
93
|
+
}
|
|
94
|
+
const options = {
|
|
95
|
+
method: "GET",
|
|
96
|
+
headers: this.settings.baseHeaders,
|
|
97
|
+
timeoutSecs: this.settings.timeoutSecs,
|
|
98
|
+
};
|
|
99
|
+
const response = await sendRequestAndReadResponse(this.settings.dispatcher, options, pollingUrl);
|
|
46
100
|
return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, response, JobResponse);
|
|
47
101
|
}
|
|
48
102
|
/**
|
|
@@ -52,9 +106,8 @@ export class MindeeApiV2 {
|
|
|
52
106
|
* @param inferenceId The inference ID for the result.
|
|
53
107
|
* @returns a `Promise` containing the parsed result.
|
|
54
108
|
*/
|
|
55
|
-
async
|
|
56
|
-
|
|
57
|
-
return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, queueResponse, product.responseClass);
|
|
109
|
+
async reqGetProductResultById(product, inferenceId) {
|
|
110
|
+
return this.reqGetProductResultByUrl(product, `https://${this.settings.hostname}/v2/products/${product.slug}/results/${inferenceId}`);
|
|
58
111
|
}
|
|
59
112
|
/**
|
|
60
113
|
* Get the result of a queued document from the API.
|
|
@@ -63,9 +116,17 @@ export class MindeeApiV2 {
|
|
|
63
116
|
* @param url The URL as returned by a Job's resultUrl property.
|
|
64
117
|
* @returns a `Promise` containing the parsed result.
|
|
65
118
|
*/
|
|
66
|
-
async
|
|
67
|
-
const
|
|
68
|
-
|
|
119
|
+
async reqGetProductResultByUrl(product, url) {
|
|
120
|
+
const options = {
|
|
121
|
+
method: "GET",
|
|
122
|
+
headers: this.settings.baseHeaders,
|
|
123
|
+
timeoutSecs: this.settings.timeoutSecs,
|
|
124
|
+
};
|
|
125
|
+
if (!url.startsWith("https://")) {
|
|
126
|
+
throw new MindeeError(`Invalid URL: ${url}`);
|
|
127
|
+
}
|
|
128
|
+
const response = await sendRequestAndReadResponse(this.settings.dispatcher, options, url);
|
|
129
|
+
return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, response, product.responseClass);
|
|
69
130
|
}
|
|
70
131
|
}
|
|
71
132
|
_MindeeApiV2_instances = new WeakSet(), _MindeeApiV2_processResponse = function _MindeeApiV2_processResponse(result, responseClass) {
|
|
@@ -88,54 +149,4 @@ _MindeeApiV2_instances = new WeakSet(), _MindeeApiV2_processResponse = function
|
|
|
88
149
|
logger.error(`Raised '${e}' Couldn't deserialize response object:\n${JSON.stringify(result.data)}`);
|
|
89
150
|
throw new MindeeDeserializationError("Couldn't deserialize response object.");
|
|
90
151
|
}
|
|
91
|
-
}, _MindeeApiV2_reqPostProductEnqueue =
|
|
92
|
-
/**
|
|
93
|
-
* Sends a document to the inference queue.
|
|
94
|
-
* @param product Product to enqueue.
|
|
95
|
-
* @param inputSource Local or remote file as an input.
|
|
96
|
-
* @param params {ExtractionParameters} parameters relating to the enqueueing options.
|
|
97
|
-
*/
|
|
98
|
-
async function _MindeeApiV2_reqPostProductEnqueue(product, inputSource, params) {
|
|
99
|
-
const form = params.getFormData();
|
|
100
|
-
if (inputSource instanceof LocalInputSource) {
|
|
101
|
-
form.set("file", new Blob([inputSource.fileObject]), inputSource.filename);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
form.set("url", inputSource.url);
|
|
105
|
-
}
|
|
106
|
-
const path = `/v2/products/${product.slug}/enqueue`;
|
|
107
|
-
const options = {
|
|
108
|
-
method: "POST",
|
|
109
|
-
headers: this.settings.baseHeaders,
|
|
110
|
-
hostname: this.settings.hostname,
|
|
111
|
-
path: path,
|
|
112
|
-
body: form,
|
|
113
|
-
timeoutSecs: this.settings.timeoutSecs,
|
|
114
|
-
};
|
|
115
|
-
return await sendRequestAndReadResponse(this.settings.dispatcher, options);
|
|
116
|
-
}, _MindeeApiV2_reqGetJob = async function _MindeeApiV2_reqGetJob(jobId) {
|
|
117
|
-
const options = {
|
|
118
|
-
method: "GET",
|
|
119
|
-
headers: this.settings.baseHeaders,
|
|
120
|
-
hostname: this.settings.hostname,
|
|
121
|
-
path: `/v2/jobs/${jobId}`,
|
|
122
|
-
timeoutSecs: this.settings.timeoutSecs,
|
|
123
|
-
};
|
|
124
|
-
return await sendRequestAndReadResponse(this.settings.dispatcher, options);
|
|
125
|
-
}, _MindeeApiV2_reqGetProductResult =
|
|
126
|
-
/**
|
|
127
|
-
* Make a request to GET the status of a document in the queue.
|
|
128
|
-
* @param url URL path to the result.
|
|
129
|
-
* @returns a `Promise` containing the parsed result.
|
|
130
|
-
*/
|
|
131
|
-
async function _MindeeApiV2_reqGetProductResult(url) {
|
|
132
|
-
const options = {
|
|
133
|
-
method: "GET",
|
|
134
|
-
headers: this.settings.baseHeaders,
|
|
135
|
-
timeoutSecs: this.settings.timeoutSecs,
|
|
136
|
-
};
|
|
137
|
-
if (!url.startsWith("https://")) {
|
|
138
|
-
throw new MindeeError(`Invalid URL: ${url}`);
|
|
139
|
-
}
|
|
140
|
-
return await sendRequestAndReadResponse(this.settings.dispatcher, options, url);
|
|
141
152
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StringDict } from "../../parsing/stringDict.js";
|
|
2
|
+
/** Base response contract for v2 product responses. */
|
|
2
3
|
export declare abstract class BaseResponse {
|
|
3
4
|
/**
|
|
4
5
|
* Raw text representation of the API's response.
|
|
@@ -14,4 +15,5 @@ export declare abstract class BaseResponse {
|
|
|
14
15
|
*/
|
|
15
16
|
getRawHttp(): StringDict;
|
|
16
17
|
}
|
|
18
|
+
/** Constructor signature for typed v2 response classes. */
|
|
17
19
|
export type ResponseConstructor<T extends BaseResponse> = new (serverResponse: StringDict) => T;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ErrorResponse, ErrorItem, } from "./error/index.js";
|
|
2
2
|
export type { ErrorDetails } from "./error/index.js";
|
|
3
|
-
export { Job, JobResponse, JobWebhook } from "./job/index.js";
|
|
3
|
+
export { Job, JobResponse, JobWebhook, } from "./job/index.js";
|
|
4
4
|
export { BaseInference, InferenceFile, InferenceModel, } from "./inference/index.js";
|
|
5
5
|
export { LocalResponse } from "./localResponse.js";
|
|
6
6
|
export { BaseResponse } from "./baseResponse.js";
|
package/src/v2/parsing/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ErrorResponse, ErrorItem, } from "./error/index.js";
|
|
2
|
-
export { Job, JobResponse, JobWebhook } from "./job/index.js";
|
|
2
|
+
export { Job, JobResponse, JobWebhook, } from "./job/index.js";
|
|
3
3
|
export { BaseInference, InferenceFile, InferenceModel, } from "./inference/index.js";
|
|
4
4
|
export { LocalResponse } from "./localResponse.js";
|
|
5
5
|
export { BaseResponse } from "./baseResponse.js";
|
|
@@ -2,6 +2,7 @@ import { StringDict } from "../../../parsing/index.js";
|
|
|
2
2
|
import { InferenceModel } from "./inferenceModel.js";
|
|
3
3
|
import { InferenceFile } from "./inferenceFile.js";
|
|
4
4
|
import { InferenceJob } from "./inferenceJob.js";
|
|
5
|
+
/** Shared metadata container for v2 inference payloads. */
|
|
5
6
|
export declare abstract class BaseInference {
|
|
6
7
|
/**
|
|
7
8
|
* Model info for the inference.
|
|
@@ -20,5 +21,6 @@ export declare abstract class BaseInference {
|
|
|
20
21
|
*/
|
|
21
22
|
id: string;
|
|
22
23
|
protected constructor(serverResponse: StringDict);
|
|
24
|
+
/** Returns a printable representation of inference metadata. */
|
|
23
25
|
toString(): string;
|
|
24
26
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { InferenceModel } from "./inferenceModel.js";
|
|
2
2
|
import { InferenceFile } from "./inferenceFile.js";
|
|
3
3
|
import { InferenceJob } from "./inferenceJob.js";
|
|
4
|
+
/** Shared metadata container for v2 inference payloads. */
|
|
4
5
|
export class BaseInference {
|
|
5
6
|
constructor(serverResponse) {
|
|
6
7
|
this.id = serverResponse["id"];
|
|
@@ -8,6 +9,7 @@ export class BaseInference {
|
|
|
8
9
|
this.model = new InferenceModel(serverResponse["model"]);
|
|
9
10
|
this.file = new InferenceFile(serverResponse["file"]);
|
|
10
11
|
}
|
|
12
|
+
/** Returns a printable representation of inference metadata. */
|
|
11
13
|
toString() {
|
|
12
14
|
return ("Inference\n" +
|
|
13
15
|
"#########\n" +
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StringDict } from "../../../parsing/index.js";
|
|
2
|
+
import { ErrorResponse } from "../../../v2/index.js";
|
|
3
|
+
import { BaseResponse } from "../../../v2/parsing/baseResponse.js";
|
|
4
|
+
/**
|
|
5
|
+
* Webhook payload returned when an inference fails before producing a result.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FailedInferenceResponse extends BaseResponse {
|
|
8
|
+
/**
|
|
9
|
+
* UUID of the failed inference.
|
|
10
|
+
*/
|
|
11
|
+
inferenceId: string;
|
|
12
|
+
/**
|
|
13
|
+
* UUID of the model used.
|
|
14
|
+
*/
|
|
15
|
+
modelId: string;
|
|
16
|
+
/**
|
|
17
|
+
* Name of the input file.
|
|
18
|
+
*/
|
|
19
|
+
fileName: string;
|
|
20
|
+
/**
|
|
21
|
+
* Alias sent for the file, if any.
|
|
22
|
+
*/
|
|
23
|
+
fileAlias?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Problem details for the failure, if available.
|
|
26
|
+
*/
|
|
27
|
+
error: ErrorResponse;
|
|
28
|
+
/**
|
|
29
|
+
* Date and time when the inference was started.
|
|
30
|
+
*/
|
|
31
|
+
createdAt: Date | null;
|
|
32
|
+
constructor(serverResponse: StringDict);
|
|
33
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { parseDate } from "../../../parsing/index.js";
|
|
2
|
+
import { ErrorResponse } from "../../../v2/index.js";
|
|
3
|
+
import { BaseResponse } from "../../../v2/parsing/baseResponse.js";
|
|
4
|
+
/**
|
|
5
|
+
* Webhook payload returned when an inference fails before producing a result.
|
|
6
|
+
*/
|
|
7
|
+
export class FailedInferenceResponse extends BaseResponse {
|
|
8
|
+
constructor(serverResponse) {
|
|
9
|
+
super(serverResponse);
|
|
10
|
+
this.inferenceId = serverResponse["inference_id"];
|
|
11
|
+
this.modelId = serverResponse["model_id"];
|
|
12
|
+
this.fileName = serverResponse["file_name"];
|
|
13
|
+
this.fileAlias = serverResponse["file_alias"];
|
|
14
|
+
this.error = new ErrorResponse(serverResponse["error"]);
|
|
15
|
+
this.createdAt = parseDate(serverResponse["created_at"]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -2,8 +2,11 @@ import { FieldConfidence } from "./fieldConfidence.js";
|
|
|
2
2
|
import { StringDict } from "../../../../parsing/stringDict.js";
|
|
3
3
|
import { FieldLocation } from "./fieldLocation.js";
|
|
4
4
|
export declare abstract class BaseField {
|
|
5
|
+
/** Indentation level used when rendering field text output. */
|
|
5
6
|
protected _indentLevel: number;
|
|
7
|
+
/** Confidence level associated with this field. */
|
|
6
8
|
confidence: FieldConfidence | undefined;
|
|
9
|
+
/** Optional list of source locations for this field. */
|
|
7
10
|
locations: Array<FieldLocation> | undefined;
|
|
8
11
|
protected constructor(rawResponse: StringDict, indentLevel?: number);
|
|
9
12
|
}
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
* Confidence level of a field as returned by the V2 API.
|
|
3
3
|
*/
|
|
4
4
|
export declare enum FieldConfidence {
|
|
5
|
+
/** Maximum confidence level. */
|
|
5
6
|
Certain = "Certain",
|
|
7
|
+
/** High confidence level. */
|
|
6
8
|
High = "High",
|
|
9
|
+
/** Medium confidence level. */
|
|
7
10
|
Medium = "Medium",
|
|
11
|
+
/** Low confidence level. */
|
|
8
12
|
Low = "Low"
|
|
9
13
|
}
|
|
10
14
|
export declare namespace FieldConfidence {
|
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export var FieldConfidence;
|
|
6
6
|
(function (FieldConfidence) {
|
|
7
|
+
/** Maximum confidence level. */
|
|
7
8
|
FieldConfidence["Certain"] = "Certain";
|
|
9
|
+
/** High confidence level. */
|
|
8
10
|
FieldConfidence["High"] = "High";
|
|
11
|
+
/** Medium confidence level. */
|
|
9
12
|
FieldConfidence["Medium"] = "Medium";
|
|
13
|
+
/** Low confidence level. */
|
|
10
14
|
FieldConfidence["Low"] = "Low";
|
|
11
15
|
})(FieldConfidence || (FieldConfidence = {}));
|
|
12
16
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
@@ -5,4 +5,9 @@ import { StringDict } from "../../../../parsing/stringDict.js";
|
|
|
5
5
|
import { ListField } from "./listField.js";
|
|
6
6
|
import { ObjectField } from "./objectField.js";
|
|
7
7
|
import { SimpleField } from "./simpleField.js";
|
|
8
|
+
/**
|
|
9
|
+
* Create a field from a server response.
|
|
10
|
+
* @param serverResponse Server response.
|
|
11
|
+
* @param indentLevel Indent level.
|
|
12
|
+
*/
|
|
8
13
|
export declare function createField(serverResponse: StringDict, indentLevel?: number): SimpleField | ObjectField | ListField;
|
|
@@ -2,6 +2,11 @@ import { MindeeDeserializationError } from "../../../../errors/index.js";
|
|
|
2
2
|
import { ListField } from "./listField.js";
|
|
3
3
|
import { ObjectField } from "./objectField.js";
|
|
4
4
|
import { SimpleField } from "./simpleField.js";
|
|
5
|
+
/**
|
|
6
|
+
* Create a field from a server response.
|
|
7
|
+
* @param serverResponse Server response.
|
|
8
|
+
* @param indentLevel Indent level.
|
|
9
|
+
*/
|
|
5
10
|
export function createField(serverResponse, indentLevel = 0) {
|
|
6
11
|
if (typeof serverResponse !== "object" || serverResponse === null) {
|
|
7
12
|
throw new MindeeDeserializationError(`Unrecognized field format ${JSON.stringify(serverResponse)}.`);
|
|
@@ -2,11 +2,16 @@ import { StringDict } from "../../../../parsing/stringDict.js";
|
|
|
2
2
|
import type { ListField } from "./listField.js";
|
|
3
3
|
import type { ObjectField } from "./objectField.js";
|
|
4
4
|
import type { SimpleField } from "./simpleField.js";
|
|
5
|
+
/** Typed map of extraction fields returned by the API. */
|
|
5
6
|
export declare class InferenceFields extends Map<string, SimpleField | ObjectField | ListField> {
|
|
7
|
+
/** Indentation level used when rendering text output. */
|
|
6
8
|
protected _indentLevel: number;
|
|
7
9
|
constructor(serverResponse: StringDict, indentLevel?: number);
|
|
10
|
+
/** Returns a field as a `SimpleField`, or throws if the type mismatches. */
|
|
8
11
|
getSimpleField(fieldName: string): SimpleField;
|
|
12
|
+
/** Returns a field as an `ObjectField`, or throws if the type mismatches. */
|
|
9
13
|
getObjectField(fieldName: string): ObjectField;
|
|
14
|
+
/** Returns a field as a `ListField`, or throws if the type mismatches. */
|
|
10
15
|
getListField(fieldName: string): ListField;
|
|
11
16
|
toString(indent?: number): string;
|
|
12
17
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createField } from "./fieldFactory.js";
|
|
2
|
+
/** Typed map of extraction fields returned by the API. */
|
|
2
3
|
export class InferenceFields extends Map {
|
|
3
4
|
constructor(serverResponse, indentLevel = 0) {
|
|
4
5
|
super(Object.entries(serverResponse).map(([key, value]) => {
|
|
@@ -6,6 +7,7 @@ export class InferenceFields extends Map {
|
|
|
6
7
|
}));
|
|
7
8
|
this._indentLevel = indentLevel;
|
|
8
9
|
}
|
|
10
|
+
/** Returns a field as a `SimpleField`, or throws if the type mismatches. */
|
|
9
11
|
getSimpleField(fieldName) {
|
|
10
12
|
const field = this.get(fieldName);
|
|
11
13
|
if (field === undefined) {
|
|
@@ -16,6 +18,7 @@ export class InferenceFields extends Map {
|
|
|
16
18
|
}
|
|
17
19
|
return field;
|
|
18
20
|
}
|
|
21
|
+
/** Returns a field as an `ObjectField`, or throws if the type mismatches. */
|
|
19
22
|
getObjectField(fieldName) {
|
|
20
23
|
const field = this.get(fieldName);
|
|
21
24
|
if (field === undefined) {
|
|
@@ -26,6 +29,7 @@ export class InferenceFields extends Map {
|
|
|
26
29
|
}
|
|
27
30
|
return field;
|
|
28
31
|
}
|
|
32
|
+
/** Returns a field as a `ListField`, or throws if the type mismatches. */
|
|
29
33
|
getListField(fieldName) {
|
|
30
34
|
const field = this.get(fieldName);
|
|
31
35
|
if (field === undefined) {
|
|
@@ -2,6 +2,7 @@ import { StringDict } from "../../../../parsing/stringDict.js";
|
|
|
2
2
|
import { BaseField } from "./baseField.js";
|
|
3
3
|
import { ObjectField } from "./objectField.js";
|
|
4
4
|
import { SimpleField } from "./simpleField.js";
|
|
5
|
+
/** List-valued inference field. */
|
|
5
6
|
export declare class ListField extends BaseField {
|
|
6
7
|
/**
|
|
7
8
|
* Items contained in the list.
|
|
@@ -16,5 +17,6 @@ export declare class ListField extends BaseField {
|
|
|
16
17
|
*/
|
|
17
18
|
get objectItems(): Array<ObjectField>;
|
|
18
19
|
constructor(serverResponse: StringDict, indentLevel?: number);
|
|
20
|
+
/** Returns a readable representation of list items. */
|
|
19
21
|
toString(): string;
|
|
20
22
|
}
|
|
@@ -3,6 +3,7 @@ import { BaseField } from "./baseField.js";
|
|
|
3
3
|
import { ObjectField } from "./objectField.js";
|
|
4
4
|
import { SimpleField } from "./simpleField.js";
|
|
5
5
|
import { createField } from "./fieldFactory.js";
|
|
6
|
+
/** List-valued inference field. */
|
|
6
7
|
export class ListField extends BaseField {
|
|
7
8
|
/**
|
|
8
9
|
* SimpleField items from the list.
|
|
@@ -43,6 +44,7 @@ export class ListField extends BaseField {
|
|
|
43
44
|
return createField(item, indentLevel + 1);
|
|
44
45
|
});
|
|
45
46
|
}
|
|
47
|
+
/** Returns a readable representation of list items. */
|
|
46
48
|
toString() {
|
|
47
49
|
if (!this.items || this.items.length === 0) {
|
|
48
50
|
return "\n";
|
|
@@ -3,7 +3,9 @@ import { StringDict } from "../../../../parsing/stringDict.js";
|
|
|
3
3
|
import { BaseField } from "./baseField.js";
|
|
4
4
|
import type { SimpleField } from "./simpleField.js";
|
|
5
5
|
import type { ListField } from "./listField.js";
|
|
6
|
+
/** Object-valued inference field. */
|
|
6
7
|
export declare class ObjectField extends BaseField {
|
|
8
|
+
/** Nested fields carried by this object. */
|
|
7
9
|
readonly fields: InferenceFields;
|
|
8
10
|
/**
|
|
9
11
|
* Retrieves the simple sub-fields in the object.
|
|
@@ -48,6 +50,8 @@ export declare class ObjectField extends BaseField {
|
|
|
48
50
|
*/
|
|
49
51
|
getObjectField(fieldName: string): ObjectField;
|
|
50
52
|
constructor(serverResponse: StringDict, indentLevel?: number);
|
|
53
|
+
/** Returns a readable representation of nested fields. */
|
|
51
54
|
toString(): string;
|
|
55
|
+
/** Returns a compact representation suitable for list items. */
|
|
52
56
|
toStringFromList(): string;
|
|
53
57
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InferenceFields } from "./inferenceFields.js";
|
|
2
2
|
import { BaseField } from "./baseField.js";
|
|
3
|
+
/** Object-valued inference field. */
|
|
3
4
|
export class ObjectField extends BaseField {
|
|
4
5
|
/**
|
|
5
6
|
* Retrieves the simple sub-fields in the object.
|
|
@@ -95,9 +96,11 @@ export class ObjectField extends BaseField {
|
|
|
95
96
|
super(serverResponse, indentLevel);
|
|
96
97
|
this.fields = new InferenceFields(serverResponse["fields"], this._indentLevel + 1);
|
|
97
98
|
}
|
|
99
|
+
/** Returns a readable representation of nested fields. */
|
|
98
100
|
toString() {
|
|
99
101
|
return "\n" + (this.fields ? this.fields.toString(1) : "");
|
|
100
102
|
}
|
|
103
|
+
/** Returns a compact representation suitable for list items. */
|
|
101
104
|
toStringFromList() {
|
|
102
105
|
return this.fields ? this.fields.toString(2).substring(4) : "";
|
|
103
106
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { StringDict } from "../../../../parsing/stringDict.js";
|
|
2
2
|
import { RawTextPage } from "./rawTextPage.js";
|
|
3
|
+
/** Full raw OCR text grouped by page. */
|
|
3
4
|
export declare class RawText {
|
|
4
5
|
/**
|
|
5
6
|
* List of pages with their extracted text content.
|
|
6
7
|
*/
|
|
7
8
|
pages: Array<RawTextPage>;
|
|
8
9
|
constructor(serverResponse: StringDict);
|
|
10
|
+
/** Returns concatenated raw text for all pages. */
|
|
9
11
|
toString(): string;
|
|
10
12
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { RawTextPage } from "./rawTextPage.js";
|
|
2
|
+
/** Full raw OCR text grouped by page. */
|
|
2
3
|
export class RawText {
|
|
3
4
|
constructor(serverResponse) {
|
|
4
5
|
this.pages = serverResponse["pages"] ? serverResponse["pages"].map((rawTextPage) => new RawTextPage(rawTextPage)) : [];
|
|
5
6
|
}
|
|
7
|
+
/** Returns concatenated raw text for all pages. */
|
|
6
8
|
toString() {
|
|
7
9
|
return this.pages.map(page => page.toString()).join("\n\n");
|
|
8
10
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { StringDict } from "../../../../parsing/stringDict.js";
|
|
2
2
|
import { BaseField } from "./baseField.js";
|
|
3
|
+
/** Scalar inference field. */
|
|
3
4
|
export declare class SimpleField extends BaseField {
|
|
4
5
|
/**
|
|
5
6
|
* The untyped value of the field.
|
|
@@ -23,5 +24,6 @@ export declare class SimpleField extends BaseField {
|
|
|
23
24
|
* Retrieves a boolean field value as a boolean.
|
|
24
25
|
*/
|
|
25
26
|
get booleanValue(): boolean | null;
|
|
27
|
+
/** Returns a readable scalar representation. */
|
|
26
28
|
toString(): string;
|
|
27
29
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseField } from "./baseField.js";
|
|
2
|
+
/** Scalar inference field. */
|
|
2
3
|
export class SimpleField extends BaseField {
|
|
3
4
|
constructor(serverResponse, indentLevel = 0) {
|
|
4
5
|
super(serverResponse, indentLevel);
|
|
@@ -32,6 +33,7 @@ export class SimpleField extends BaseField {
|
|
|
32
33
|
}
|
|
33
34
|
return this.value;
|
|
34
35
|
}
|
|
36
|
+
/** Returns a readable scalar representation. */
|
|
35
37
|
toString() {
|
|
36
38
|
if (this.value === null) {
|
|
37
39
|
return "";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StringDict } from "../../../parsing/stringDict.js";
|
|
2
|
+
/** File metadata attached to a v2 inference. */
|
|
2
3
|
export declare class InferenceFile {
|
|
3
4
|
/**
|
|
4
5
|
* Name of the file.
|
|
@@ -17,5 +18,6 @@ export declare class InferenceFile {
|
|
|
17
18
|
*/
|
|
18
19
|
mimeType: string;
|
|
19
20
|
constructor(serverResponse: StringDict);
|
|
21
|
+
/** Returns a printable representation of file metadata. */
|
|
20
22
|
toString(): string;
|
|
21
23
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** File metadata attached to a v2 inference. */
|
|
1
2
|
export class InferenceFile {
|
|
2
3
|
constructor(serverResponse) {
|
|
3
4
|
this.name = serverResponse["name"];
|
|
@@ -5,6 +6,7 @@ export class InferenceFile {
|
|
|
5
6
|
this.pageCount = serverResponse["page_count"];
|
|
6
7
|
this.mimeType = serverResponse["mime_type"];
|
|
7
8
|
}
|
|
9
|
+
/** Returns a printable representation of file metadata. */
|
|
8
10
|
toString() {
|
|
9
11
|
return ("File\n" +
|
|
10
12
|
"====\n" +
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { StringDict } from "../../../parsing/stringDict.js";
|
|
2
|
+
/** Model metadata attached to a v2 inference. */
|
|
2
3
|
export declare class InferenceModel {
|
|
3
4
|
/**
|
|
4
5
|
* ID of the model.
|
|
5
6
|
*/
|
|
6
7
|
id: string;
|
|
7
8
|
constructor(serverResponse: StringDict);
|
|
9
|
+
/** Returns a printable representation of model metadata. */
|
|
8
10
|
toString(): string;
|
|
9
11
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/** Model metadata attached to a v2 inference. */
|
|
1
2
|
export class InferenceModel {
|
|
2
3
|
constructor(serverResponse) {
|
|
3
4
|
this.id = serverResponse["id"];
|
|
4
5
|
}
|
|
6
|
+
/** Returns a printable representation of model metadata. */
|
|
5
7
|
toString() {
|
|
6
8
|
return "Model\n" +
|
|
7
9
|
"=====\n" +
|