@aws-amplify/predictions 6.0.22 → 6.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Predictions.js +2 -4
- package/dist/cjs/Predictions.js.map +1 -1
- package/dist/cjs/providers/AmazonAIConvertPredictionsProvider.js +9 -9
- package/dist/cjs/providers/AmazonAIConvertPredictionsProvider.js.map +1 -1
- package/dist/cjs/providers/AmazonAIIdentifyPredictionsProvider.js +25 -20
- package/dist/cjs/providers/AmazonAIIdentifyPredictionsProvider.js.map +1 -1
- package/dist/cjs/providers/AmazonAIInterpretPredictionsProvider.js +7 -7
- package/dist/cjs/providers/AmazonAIInterpretPredictionsProvider.js.map +1 -1
- package/dist/cjs/providers/IdentifyTextUtils.js +9 -9
- package/dist/cjs/providers/IdentifyTextUtils.js.map +1 -1
- package/dist/cjs/providers/Utils.js +6 -6
- package/dist/cjs/providers/Utils.js.map +1 -1
- package/dist/cjs/types/Predictions.js +15 -14
- package/dist/cjs/types/Predictions.js.map +1 -1
- package/dist/esm/Predictions.mjs +0 -2
- package/dist/esm/Predictions.mjs.map +1 -1
- package/dist/esm/providers/AmazonAIConvertPredictionsProvider.mjs +9 -9
- package/dist/esm/providers/AmazonAIConvertPredictionsProvider.mjs.map +1 -1
- package/dist/esm/providers/AmazonAIIdentifyPredictionsProvider.d.ts +6 -6
- package/dist/esm/providers/AmazonAIIdentifyPredictionsProvider.mjs +25 -20
- package/dist/esm/providers/AmazonAIIdentifyPredictionsProvider.mjs.map +1 -1
- package/dist/esm/providers/AmazonAIInterpretPredictionsProvider.mjs +7 -7
- package/dist/esm/providers/AmazonAIInterpretPredictionsProvider.mjs.map +1 -1
- package/dist/esm/providers/IdentifyTextUtils.mjs +9 -9
- package/dist/esm/providers/IdentifyTextUtils.mjs.map +1 -1
- package/dist/esm/providers/Utils.mjs +6 -6
- package/dist/esm/providers/Utils.mjs.map +1 -1
- package/dist/esm/types/AWSTypes.d.ts +2 -2
- package/dist/esm/types/Predictions.d.ts +30 -30
- package/dist/esm/types/Predictions.mjs +15 -14
- package/dist/esm/types/Predictions.mjs.map +1 -1
- package/package.json +6 -5
- package/src/Predictions.ts +2 -3
- package/src/providers/AmazonAIConvertPredictionsProvider.ts +20 -10
- package/src/providers/AmazonAIIdentifyPredictionsProvider.ts +41 -26
- package/src/providers/AmazonAIInterpretPredictionsProvider.ts +22 -18
- package/src/providers/IdentifyTextUtils.ts +25 -22
- package/src/providers/Utils.ts +8 -6
- package/src/providers/index.ts +1 -0
- package/src/types/AWSTypes.ts +2 -3
- package/src/types/Predictions.ts +60 -44
package/src/types/Predictions.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
/* tslint:disable:max-line-length */
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Convert types
|
|
@@ -49,9 +48,9 @@ export interface TextEntities {
|
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
export type KeyPhrases = KeyPhrase[];
|
|
52
|
-
export
|
|
51
|
+
export interface KeyPhrase {
|
|
53
52
|
text?: string;
|
|
54
|
-
}
|
|
53
|
+
}
|
|
55
54
|
|
|
56
55
|
export interface TextSyntax {
|
|
57
56
|
text: string;
|
|
@@ -66,18 +65,18 @@ export interface TextSentiment {
|
|
|
66
65
|
mixed: number;
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
export
|
|
68
|
+
export interface DetectParams {
|
|
70
69
|
Text: string;
|
|
71
70
|
LanguageCode: string;
|
|
72
|
-
}
|
|
71
|
+
}
|
|
73
72
|
|
|
74
73
|
export interface InterpretTextOutput {
|
|
75
74
|
textInterpretation: {
|
|
76
75
|
language?: string;
|
|
77
|
-
textEntities?:
|
|
76
|
+
textEntities?: TextEntities[];
|
|
78
77
|
keyPhrases?: KeyPhrases;
|
|
79
78
|
sentiment?: TextSentiment;
|
|
80
|
-
syntax?:
|
|
79
|
+
syntax?: TextSyntax[];
|
|
81
80
|
};
|
|
82
81
|
}
|
|
83
82
|
|
|
@@ -136,11 +135,11 @@ export interface SpeechToTextInput {
|
|
|
136
135
|
};
|
|
137
136
|
}
|
|
138
137
|
|
|
139
|
-
export
|
|
138
|
+
export interface TranscribeData {
|
|
140
139
|
connection: WebSocket;
|
|
141
140
|
raw: ConvertBytes;
|
|
142
141
|
languageCode: string;
|
|
143
|
-
}
|
|
142
|
+
}
|
|
144
143
|
|
|
145
144
|
export interface SpeechToTextOutput {
|
|
146
145
|
transcription: {
|
|
@@ -181,8 +180,8 @@ export interface Content {
|
|
|
181
180
|
export interface TableCell extends Content {
|
|
182
181
|
boundingBox?: BoundingBox;
|
|
183
182
|
polygon?: Polygon;
|
|
184
|
-
rowSpan?:
|
|
185
|
-
columnSpan?:
|
|
183
|
+
rowSpan?: number;
|
|
184
|
+
columnSpan?: number;
|
|
186
185
|
}
|
|
187
186
|
|
|
188
187
|
export interface Table {
|
|
@@ -226,24 +225,24 @@ export interface IdentifyLabelsInput {
|
|
|
226
225
|
}
|
|
227
226
|
|
|
228
227
|
export interface Point {
|
|
229
|
-
x?:
|
|
230
|
-
y?:
|
|
228
|
+
x?: number;
|
|
229
|
+
y?: number;
|
|
231
230
|
}
|
|
232
231
|
|
|
233
|
-
export type Polygon =
|
|
232
|
+
export type Polygon = Point[] | Iterable<Point>;
|
|
234
233
|
|
|
235
234
|
export interface BoundingBox {
|
|
236
|
-
width?:
|
|
237
|
-
height?:
|
|
238
|
-
left?:
|
|
239
|
-
top?:
|
|
235
|
+
width?: number;
|
|
236
|
+
height?: number;
|
|
237
|
+
left?: number;
|
|
238
|
+
top?: number;
|
|
240
239
|
}
|
|
241
240
|
|
|
242
241
|
export interface IdentifyLabelsOutput {
|
|
243
242
|
labels?: {
|
|
244
243
|
name?: string;
|
|
245
244
|
boundingBoxes?: (BoundingBox | undefined)[];
|
|
246
|
-
metadata?:
|
|
245
|
+
metadata?: object;
|
|
247
246
|
}[];
|
|
248
247
|
unsafe?: 'YES' | 'NO' | 'UNKNOWN';
|
|
249
248
|
}
|
|
@@ -280,18 +279,18 @@ export interface FaceAttributes {
|
|
|
280
279
|
emotions?: (string | undefined)[];
|
|
281
280
|
}
|
|
282
281
|
|
|
283
|
-
export
|
|
284
|
-
low?:
|
|
285
|
-
high?:
|
|
286
|
-
}
|
|
282
|
+
export interface EntityAgeRange {
|
|
283
|
+
low?: number;
|
|
284
|
+
high?: number;
|
|
285
|
+
}
|
|
287
286
|
|
|
288
|
-
export
|
|
287
|
+
export interface EntityLandmark {
|
|
289
288
|
type?: string;
|
|
290
289
|
x?: number;
|
|
291
290
|
y?: number;
|
|
292
|
-
}
|
|
291
|
+
}
|
|
293
292
|
|
|
294
|
-
export
|
|
293
|
+
export interface EntityMetadata {
|
|
295
294
|
id?: string;
|
|
296
295
|
name?: string;
|
|
297
296
|
pose?: {
|
|
@@ -303,15 +302,15 @@ export type EntityMetadata = {
|
|
|
303
302
|
externalImageId?: string;
|
|
304
303
|
similarity?: number;
|
|
305
304
|
confidence?: number;
|
|
306
|
-
}
|
|
305
|
+
}
|
|
307
306
|
|
|
308
|
-
export
|
|
307
|
+
export interface IdentifyEntity {
|
|
309
308
|
boundingBox?: BoundingBox;
|
|
310
309
|
ageRange?: EntityAgeRange;
|
|
311
310
|
landmarks?: (EntityLandmark | undefined)[];
|
|
312
311
|
attributes?: FaceAttributes;
|
|
313
312
|
metadata?: EntityMetadata;
|
|
314
|
-
}
|
|
313
|
+
}
|
|
315
314
|
|
|
316
315
|
export interface IdentifyEntitiesOutput {
|
|
317
316
|
entities: IdentifyEntity[];
|
|
@@ -342,73 +341,90 @@ export function isIdentifyFromCollection(
|
|
|
342
341
|
): obj is IdentifyFromCollection {
|
|
343
342
|
const key: keyof IdentifyFromCollection = 'collection';
|
|
344
343
|
const keyId: keyof IdentifyFromCollection = 'collectionId';
|
|
345
|
-
|
|
344
|
+
|
|
345
|
+
return (
|
|
346
|
+
obj &&
|
|
347
|
+
(Object.prototype.hasOwnProperty.call(obj, key) ||
|
|
348
|
+
Object.prototype.hasOwnProperty.call(obj, keyId))
|
|
349
|
+
);
|
|
346
350
|
}
|
|
347
351
|
|
|
348
352
|
export function isIdentifyCelebrities(obj: any): obj is IdentifyCelebrities {
|
|
349
353
|
const key: keyof IdentifyCelebrities = 'celebrityDetection';
|
|
350
|
-
|
|
354
|
+
|
|
355
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, key);
|
|
351
356
|
}
|
|
352
357
|
|
|
353
358
|
export function isTranslateTextInput(obj: any): obj is TranslateTextInput {
|
|
354
359
|
const key: keyof TranslateTextInput = 'translateText';
|
|
355
|
-
|
|
360
|
+
|
|
361
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, key);
|
|
356
362
|
}
|
|
357
363
|
|
|
358
364
|
export function isTextToSpeechInput(obj: any): obj is TextToSpeechInput {
|
|
359
365
|
const key: keyof TextToSpeechInput = 'textToSpeech';
|
|
360
|
-
|
|
366
|
+
|
|
367
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, key);
|
|
361
368
|
}
|
|
362
369
|
|
|
363
370
|
export function isSpeechToTextInput(obj: any): obj is SpeechToTextInput {
|
|
364
371
|
const key: keyof SpeechToTextInput = 'transcription';
|
|
365
|
-
|
|
372
|
+
|
|
373
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, key);
|
|
366
374
|
}
|
|
367
375
|
|
|
368
376
|
export function isStorageSource(obj: any): obj is StorageSource {
|
|
369
377
|
const key: keyof StorageSource = 'key';
|
|
370
|
-
|
|
378
|
+
|
|
379
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, key);
|
|
371
380
|
}
|
|
372
381
|
|
|
373
382
|
export function isFileSource(obj: any): obj is FileSource {
|
|
374
383
|
const key: keyof FileSource = 'file';
|
|
375
|
-
|
|
384
|
+
|
|
385
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, key);
|
|
376
386
|
}
|
|
377
387
|
|
|
378
388
|
export function isConvertBytesSource(
|
|
379
389
|
obj: any,
|
|
380
390
|
): obj is BytesSource<ConvertBytes> {
|
|
381
391
|
const key: keyof BytesSource<ConvertBytes> = 'bytes';
|
|
382
|
-
|
|
392
|
+
|
|
393
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, key);
|
|
383
394
|
}
|
|
384
395
|
|
|
385
396
|
export function isIdentifyBytesSource(
|
|
386
397
|
obj: any,
|
|
387
398
|
): obj is BytesSource<IdentifyBytes> {
|
|
388
399
|
const key: keyof BytesSource<IdentifyBytes> = 'bytes';
|
|
389
|
-
|
|
400
|
+
|
|
401
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, key);
|
|
390
402
|
}
|
|
391
403
|
|
|
392
404
|
export function isIdentifyTextInput(obj: any): obj is IdentifyTextInput {
|
|
393
405
|
const key: keyof IdentifyTextInput = 'text';
|
|
394
|
-
|
|
406
|
+
|
|
407
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, key);
|
|
395
408
|
}
|
|
396
409
|
|
|
397
410
|
export function isIdentifyLabelsInput(obj: any): obj is IdentifyLabelsInput {
|
|
398
411
|
const key: keyof IdentifyLabelsInput = 'labels';
|
|
399
|
-
|
|
412
|
+
|
|
413
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, key);
|
|
400
414
|
}
|
|
401
415
|
|
|
402
416
|
export function isIdentifyEntitiesInput(
|
|
403
417
|
obj: any,
|
|
404
418
|
): obj is IdentifyEntitiesInput {
|
|
405
419
|
const key: keyof IdentifyEntitiesInput = 'entities';
|
|
406
|
-
|
|
420
|
+
|
|
421
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, key);
|
|
407
422
|
}
|
|
408
423
|
|
|
409
424
|
export function isInterpretTextInput(obj: any): obj is InterpretTextInput {
|
|
410
425
|
const key: keyof InterpretTextInput = 'text';
|
|
411
|
-
|
|
426
|
+
|
|
427
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, key);
|
|
412
428
|
}
|
|
413
429
|
|
|
414
430
|
export function isInterpretTextOthers(
|
|
@@ -426,7 +442,7 @@ export interface Geometry {
|
|
|
426
442
|
/**
|
|
427
443
|
* <p>Within the bounding box, a fine-grained polygon around the detected text.</p>
|
|
428
444
|
*/
|
|
429
|
-
Polygon?:
|
|
445
|
+
Polygon?: Point[] | Iterable<Point>;
|
|
430
446
|
}
|
|
431
447
|
|
|
432
448
|
export interface Relationship {
|
|
@@ -438,7 +454,7 @@ export interface Relationship {
|
|
|
438
454
|
/**
|
|
439
455
|
* <p>An array of IDs for related blocks. You can get the type of the relationship from the <code>Type</code> element.</p>
|
|
440
456
|
*/
|
|
441
|
-
Ids?:
|
|
457
|
+
Ids?: string[] | Iterable<string>;
|
|
442
458
|
}
|
|
443
459
|
|
|
444
460
|
export type FeatureType = 'TABLES' | 'FORMS' | string;
|