mindee 4.27.0 → 4.27.1
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 +6 -0
- package/package.json +1 -1
- package/src/client.js +2 -5
- package/src/http/endpoint.d.ts +2 -1
- package/src/http/endpoint.js +22 -5
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -81,9 +81,6 @@ class Client {
|
|
|
81
81
|
*/
|
|
82
82
|
async enqueue(productClass, inputSource, params = {}) {
|
|
83
83
|
const endpoint = params?.endpoint ?? __classPrivateFieldGet(this, _Client_instances, "m", _Client_initializeOTSEndpoint).call(this, productClass);
|
|
84
|
-
if (params.workflowId) {
|
|
85
|
-
endpoint.useWorkflowId(params.workflowId);
|
|
86
|
-
}
|
|
87
84
|
if (inputSource === undefined) {
|
|
88
85
|
throw new Error("The 'parse' function requires an input document.");
|
|
89
86
|
}
|
|
@@ -93,8 +90,8 @@ class Client {
|
|
|
93
90
|
fullText: this.getBooleanParam(params.fullText),
|
|
94
91
|
pageOptions: params?.pageOptions,
|
|
95
92
|
cropper: this.getBooleanParam(params.cropper),
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
rag: this.getBooleanParam(params.rag),
|
|
94
|
+
workflowId: params.workflowId
|
|
98
95
|
});
|
|
99
96
|
return new common_1.AsyncPredictResponse(productClass, rawResponse.data);
|
|
100
97
|
}
|
package/src/http/endpoint.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export declare class Endpoint extends BaseEndpoint {
|
|
|
64
64
|
* @param fullText
|
|
65
65
|
* @param cropper
|
|
66
66
|
* @param rag
|
|
67
|
+
* @param workflowId
|
|
67
68
|
*/
|
|
68
|
-
protected sendFileForPrediction(input: InputSource, predictUrl: string, includeWords?: boolean, fullText?: boolean, cropper?: boolean, rag?: boolean): Promise<EndpointResponse>;
|
|
69
|
+
protected sendFileForPrediction(input: InputSource, predictUrl: string, includeWords?: boolean, fullText?: boolean, cropper?: boolean, rag?: boolean, workflowId?: string | undefined): Promise<EndpointResponse>;
|
|
69
70
|
}
|
package/src/http/endpoint.js
CHANGED
|
@@ -64,7 +64,7 @@ class Endpoint extends baseEndpoint_1.BaseEndpoint {
|
|
|
64
64
|
if (params.pageOptions !== undefined) {
|
|
65
65
|
await super.cutDocPages(params.inputDoc, params.pageOptions);
|
|
66
66
|
}
|
|
67
|
-
const response = await __classPrivateFieldGet(this, _Endpoint_instances, "m", _Endpoint_predictAsyncReqPost).call(this, params.inputDoc, params.includeWords, params.fullText, params.cropper, params.rag);
|
|
67
|
+
const response = await __classPrivateFieldGet(this, _Endpoint_instances, "m", _Endpoint_predictAsyncReqPost).call(this, params.inputDoc, params.includeWords, params.fullText, params.cropper, params.rag, params.workflowId);
|
|
68
68
|
if (!(0, responseValidation_1.isValidAsyncResponse)(response)) {
|
|
69
69
|
(0, error_1.handleError)(this.urlName, response, this.extractStatusMessage(response));
|
|
70
70
|
}
|
|
@@ -137,8 +137,9 @@ class Endpoint extends baseEndpoint_1.BaseEndpoint {
|
|
|
137
137
|
* @param fullText
|
|
138
138
|
* @param cropper
|
|
139
139
|
* @param rag
|
|
140
|
+
* @param workflowId
|
|
140
141
|
*/
|
|
141
|
-
sendFileForPrediction(input, predictUrl, includeWords = false, fullText = false, cropper = false, rag = false) {
|
|
142
|
+
sendFileForPrediction(input, predictUrl, includeWords = false, fullText = false, cropper = false, rag = false, workflowId = undefined) {
|
|
142
143
|
return new Promise((resolve, reject) => {
|
|
143
144
|
const searchParams = new url_1.URLSearchParams();
|
|
144
145
|
if (cropper) {
|
|
@@ -163,7 +164,13 @@ class Endpoint extends baseEndpoint_1.BaseEndpoint {
|
|
|
163
164
|
form.append("include_mvision", "true");
|
|
164
165
|
}
|
|
165
166
|
const headers = { ...this.settings.baseHeaders, ...form.getHeaders() };
|
|
166
|
-
let path
|
|
167
|
+
let path;
|
|
168
|
+
if (workflowId === undefined) {
|
|
169
|
+
path = `${this.urlRoot}/${predictUrl}`;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
path = `/v1/workflows/${workflowId}/predict_async`;
|
|
173
|
+
}
|
|
167
174
|
if (searchParams.toString().length > 0) {
|
|
168
175
|
path += `?${searchParams}`;
|
|
169
176
|
}
|
|
@@ -184,8 +191,18 @@ class Endpoint extends baseEndpoint_1.BaseEndpoint {
|
|
|
184
191
|
exports.Endpoint = Endpoint;
|
|
185
192
|
_Endpoint_instances = new WeakSet(), _Endpoint_predictReqPost = function _Endpoint_predictReqPost(input, includeWords = false, fullText = false, cropper = false) {
|
|
186
193
|
return this.sendFileForPrediction(input, "predict", includeWords, fullText, cropper);
|
|
187
|
-
}, _Endpoint_predictAsyncReqPost = function _Endpoint_predictAsyncReqPost(
|
|
188
|
-
|
|
194
|
+
}, _Endpoint_predictAsyncReqPost = function _Endpoint_predictAsyncReqPost(
|
|
195
|
+
/**
|
|
196
|
+
* Make a request to POST a document for async prediction.
|
|
197
|
+
* @param input
|
|
198
|
+
* @param includeWords
|
|
199
|
+
* @param fullText
|
|
200
|
+
* @param cropper
|
|
201
|
+
* @param rag
|
|
202
|
+
* @param workflowId
|
|
203
|
+
*/
|
|
204
|
+
input, includeWords = false, fullText = false, cropper = false, rag = false, workflowId = undefined) {
|
|
205
|
+
return this.sendFileForPrediction(input, "predict_async", includeWords, fullText, cropper, rag, workflowId);
|
|
189
206
|
}, _Endpoint_documentQueueReqGet = function _Endpoint_documentQueueReqGet(queueId) {
|
|
190
207
|
return new Promise((resolve, reject) => {
|
|
191
208
|
const options = {
|