@mediapipe/tasks-text 0.0.0-nightly-20230920

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/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # MediaPipe Tasks Text Package
2
+
3
+ This package contains the text tasks for MediaPipe.
4
+
5
+ ## Language Detector
6
+
7
+ The MediaPipe Language Detector task predicts the language of an input text.
8
+
9
+ ```
10
+ const text = await FilesetResolver.forTextTasks(
11
+ "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-text/wasm"
12
+ );
13
+ const languageDetector = await LanguageDetector.createFromModelPath(text,
14
+ "https://storage.googleapis.com/mediapipe-models/language_detector/language_detector/float32/1/language_detector.tflite
15
+ );
16
+ const result = languageDetector.detect(textData);
17
+ ```
18
+
19
+ For more information, refer to the [Language Detector](https://developers.google.com/mediapipe/solutions/text/language_detector/web_js) documentation.
20
+
21
+ ## Text Classifier
22
+
23
+ The MediaPipe Text Classifier task lets you classify text into a set of defined
24
+ categories, such as positive or negative sentiment.
25
+
26
+ ```
27
+ const text = await FilesetResolver.forTextTasks(
28
+ "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-text/wasm"
29
+ );
30
+ const textClassifier = await TextClassifier.createFromModelPath(text,
31
+ "https://storage.googleapis.com/mediapipe-models/text_classifier/bert_classifier/float32/1/bert_classifier.tflite"
32
+ );
33
+ const classifications = textClassifier.classify(textData);
34
+ ```
35
+
36
+ For more information, refer to the [Text Classification](https://developers.google.com/mediapipe/solutions/text/text_classifier/web_js) documentation.
37
+
38
+ ## Text Embedder
39
+
40
+ The MediaPipe Text Embedder task extracts embeddings from text data.
41
+
42
+ ```
43
+ const text = await FilesetResolver.forTextTasks(
44
+ "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-text/wasm"
45
+ );
46
+ const textEmbedder = await TextEmbedder.createFromModelPath(text,
47
+ "https://storage.googleapis.com/mediapipe-models/text_embedder/universal_sentence_encoder/float32/1/universal_sentence_encoder.tflite"
48
+ );
49
+ const embeddings = textEmbedder.embed(textData);
50
+ ```
51
+
52
+ For more information, refer to the [Text Embedder](https://developers.google.com/mediapipe/solutions/text/text_embedder/web_js) documentation.
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@mediapipe/tasks-text",
3
+ "version": "0.0.0-nightly-20230920",
4
+ "description": "MediaPipe Text Tasks",
5
+ "main": "text_bundle.cjs",
6
+ "browser": "text_bundle.mjs",
7
+ "module": "text_bundle.mjs",
8
+ "exports": {
9
+ "import": "./text_bundle.mjs",
10
+ "require": "./text_bundle.cjs",
11
+ "default": "./text_bundle.mjs",
12
+ "types": "./text_.d.ts"
13
+ },
14
+ "author": "mediapipe@google.com",
15
+ "license": "Apache-2.0",
16
+ "type": "module",
17
+ "types": "text.d.ts",
18
+ "homepage": "http://mediapipe.dev",
19
+ "keywords": [ "AR", "ML", "Augmented", "MediaPipe", "MediaPipe Tasks" ]
20
+ }
package/text.d.ts ADDED
@@ -0,0 +1,560 @@
1
+ /**
2
+ * Copyright 2022 The MediaPipe Authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /** Options to configure MediaPipe model loading and processing. */
17
+ declare interface BaseOptions_2 {
18
+ /**
19
+ * The model path to the model asset file. Only one of `modelAssetPath` or
20
+ * `modelAssetBuffer` can be set.
21
+ */
22
+ modelAssetPath?: string | undefined;
23
+ /**
24
+ * A buffer containing the model aaset. Only one of `modelAssetPath` or
25
+ * `modelAssetBuffer` can be set.
26
+ */
27
+ modelAssetBuffer?: Uint8Array | undefined;
28
+ /** Overrides the default backend to use for the provided model. */
29
+ delegate?: "CPU" | "GPU" | undefined;
30
+ }
31
+
32
+ /**
33
+ * Copyright 2022 The MediaPipe Authors.
34
+ *
35
+ * Licensed under the Apache License, Version 2.0 (the "License");
36
+ * you may not use this file except in compliance with the License.
37
+ * You may obtain a copy of the License at
38
+ *
39
+ * http://www.apache.org/licenses/LICENSE-2.0
40
+ *
41
+ * Unless required by applicable law or agreed to in writing, software
42
+ * distributed under the License is distributed on an "AS IS" BASIS,
43
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44
+ * See the License for the specific language governing permissions and
45
+ * limitations under the License.
46
+ */
47
+ /** A classification category. */
48
+ export declare interface Category {
49
+ /** The probability score of this label category. */
50
+ score: number;
51
+ /** The index of the category in the corresponding label file. */
52
+ index: number;
53
+ /**
54
+ * The label of this category object. Defaults to an empty string if there is
55
+ * no category.
56
+ */
57
+ categoryName: string;
58
+ /**
59
+ * The display name of the label, which may be translated for different
60
+ * locales. For example, a label, "apple", may be translated into Spanish for
61
+ * display purpose, so that the `display_name` is "manzana". Defaults to an
62
+ * empty string if there is no display name.
63
+ */
64
+ displayName: string;
65
+ }
66
+
67
+ /** Classification results for a given classifier head. */
68
+ export declare interface Classifications {
69
+ /**
70
+ * The array of predicted categories, usually sorted by descending scores,
71
+ * e.g., from high to low probability.
72
+ */
73
+ categories: Category[];
74
+ /**
75
+ * The index of the classifier head these categories refer to. This is
76
+ * useful for multi-head models.
77
+ */
78
+ headIndex: number;
79
+ /**
80
+ * The name of the classifier head, which is the corresponding tensor
81
+ * metadata name. Defaults to an empty string if there is no such metadata.
82
+ */
83
+ headName: string;
84
+ }
85
+
86
+ /**
87
+ * Copyright 2022 The MediaPipe Authors.
88
+ *
89
+ * Licensed under the Apache License, Version 2.0 (the "License");
90
+ * you may not use this file except in compliance with the License.
91
+ * You may obtain a copy of the License at
92
+ *
93
+ * http://www.apache.org/licenses/LICENSE-2.0
94
+ *
95
+ * Unless required by applicable law or agreed to in writing, software
96
+ * distributed under the License is distributed on an "AS IS" BASIS,
97
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
98
+ * See the License for the specific language governing permissions and
99
+ * limitations under the License.
100
+ */
101
+ /** Options to configure a MediaPipe Classifier Task. */
102
+ declare interface ClassifierOptions {
103
+ /**
104
+ * The locale to use for display names specified through the TFLite Model
105
+ * Metadata, if any. Defaults to English.
106
+ */
107
+ displayNamesLocale?: string | undefined;
108
+ /** The maximum number of top-scored detection results to return. */
109
+ maxResults?: number | undefined;
110
+ /**
111
+ * Overrides the value provided in the model metadata. Results below this
112
+ * value are rejected.
113
+ */
114
+ scoreThreshold?: number | undefined;
115
+ /**
116
+ * Allowlist of category names. If non-empty, detection results whose category
117
+ * name is not in this set will be filtered out. Duplicate or unknown category
118
+ * names are ignored. Mutually exclusive with `categoryDenylist`.
119
+ */
120
+ categoryAllowlist?: string[] | undefined;
121
+ /**
122
+ * Denylist of category names. If non-empty, detection results whose category
123
+ * name is in this set will be filtered out. Duplicate or unknown category
124
+ * names are ignored. Mutually exclusive with `categoryAllowlist`.
125
+ */
126
+ categoryDenylist?: string[] | undefined;
127
+ }
128
+
129
+ /**
130
+ * Copyright 2022 The MediaPipe Authors.
131
+ *
132
+ * Licensed under the Apache License, Version 2.0 (the "License");
133
+ * you may not use this file except in compliance with the License.
134
+ * You may obtain a copy of the License at
135
+ *
136
+ * http://www.apache.org/licenses/LICENSE-2.0
137
+ *
138
+ * Unless required by applicable law or agreed to in writing, software
139
+ * distributed under the License is distributed on an "AS IS" BASIS,
140
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
141
+ * See the License for the specific language governing permissions and
142
+ * limitations under the License.
143
+ */
144
+ /** Options to configure a MediaPipe Embedder Task */
145
+ declare interface EmbedderOptions {
146
+ /**
147
+ * Whether to normalize the returned feature vector with L2 norm. Use this
148
+ * option only if the model does not already contain a native L2_NORMALIZATION
149
+ * TF Lite Op. In most cases, this is already the case and L2 norm is thus
150
+ * achieved through TF Lite inference.
151
+ */
152
+ l2Normalize?: boolean | undefined;
153
+ /**
154
+ * Whether the returned embedding should be quantized to bytes via scalar
155
+ * quantization. Embeddings are implicitly assumed to be unit-norm and
156
+ * therefore any dimension is guaranteed to have a value in [-1.0, 1.0]. Use
157
+ * the l2_normalize option if this is not the case.
158
+ */
159
+ quantize?: boolean | undefined;
160
+ }
161
+
162
+ /**
163
+ * Copyright 2022 The MediaPipe Authors.
164
+ *
165
+ * Licensed under the Apache License, Version 2.0 (the "License");
166
+ * you may not use this file except in compliance with the License.
167
+ * You may obtain a copy of the License at
168
+ *
169
+ * http://www.apache.org/licenses/LICENSE-2.0
170
+ *
171
+ * Unless required by applicable law or agreed to in writing, software
172
+ * distributed under the License is distributed on an "AS IS" BASIS,
173
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
174
+ * See the License for the specific language governing permissions and
175
+ * limitations under the License.
176
+ */
177
+ /**
178
+ * List of embeddings with an optional timestamp.
179
+ *
180
+ * One and only one of the two 'floatEmbedding' and 'quantizedEmbedding' will
181
+ * contain data, based on whether or not the embedder was configured to perform
182
+ * scalar quantization.
183
+ */
184
+ export declare interface Embedding {
185
+ /**
186
+ * Floating-point embedding. Empty if the embedder was configured to perform
187
+ * scalar-quantization.
188
+ */
189
+ floatEmbedding?: number[];
190
+ /**
191
+ * Scalar-quantized embedding. Empty if the embedder was not configured to
192
+ * perform scalar quantization.
193
+ */
194
+ quantizedEmbedding?: Uint8Array;
195
+ /**
196
+ * The index of the classifier head these categories refer to. This is
197
+ * useful for multi-head models.
198
+ */
199
+ headIndex: number;
200
+ /**
201
+ * The name of the classifier head, which is the corresponding tensor
202
+ * metadata name.
203
+ */
204
+ headName: string;
205
+ }
206
+
207
+ /**
208
+ * Resolves the files required for the MediaPipe Task APIs.
209
+ *
210
+ * This class verifies whether SIMD is supported in the current environment and
211
+ * loads the SIMD files only if support is detected. The returned filesets
212
+ * require that the Wasm files are published without renaming. If this is not
213
+ * possible, you can invoke the MediaPipe Tasks APIs using a manually created
214
+ * `WasmFileset`.
215
+ */
216
+ export declare class FilesetResolver {
217
+ /**
218
+ * Returns whether SIMD is supported in the current environment.
219
+ *
220
+ * If your environment requires custom locations for the MediaPipe Wasm files,
221
+ * you can use `isSimdSupported()` to decide whether to load the SIMD-based
222
+ * assets.
223
+ *
224
+ * @export
225
+ * @return Whether SIMD support was detected in the current environment.
226
+ */
227
+ static isSimdSupported(): Promise<boolean>;
228
+ /**
229
+ * Creates a fileset for the MediaPipe Audio tasks.
230
+ *
231
+ * @export
232
+ * @param basePath An optional base path to specify the directory the Wasm
233
+ * files should be loaded from. If not specified, the Wasm files are
234
+ * loaded from the host's root directory.
235
+ * @return A `WasmFileset` that can be used to initialize MediaPipe Audio
236
+ * tasks.
237
+ */
238
+ static forAudioTasks(basePath?: string): Promise<WasmFileset>;
239
+ /**
240
+ * Creates a fileset for the MediaPipe Text tasks.
241
+ *
242
+ * @export
243
+ * @param basePath An optional base path to specify the directory the Wasm
244
+ * files should be loaded from. If not specified, the Wasm files are
245
+ * loaded from the host's root directory.
246
+ * @return A `WasmFileset` that can be used to initialize MediaPipe Text
247
+ * tasks.
248
+ */
249
+ static forTextTasks(basePath?: string): Promise<WasmFileset>;
250
+ /**
251
+ * Creates a fileset for the MediaPipe Vision tasks.
252
+ *
253
+ * @export
254
+ * @param basePath An optional base path to specify the directory the Wasm
255
+ * files should be loaded from. If not specified, the Wasm files are
256
+ * loaded from the host's root directory.
257
+ * @return A `WasmFileset` that can be used to initialize MediaPipe Vision
258
+ * tasks.
259
+ */
260
+ static forVisionTasks(basePath?: string): Promise<WasmFileset>;
261
+ }
262
+
263
+ /** Predicts the language of an input text. */
264
+ export declare class LanguageDetector extends TaskRunner {
265
+ /**
266
+ * Initializes the Wasm runtime and creates a new language detector from the
267
+ * provided options.
268
+ * @export
269
+ * @param wasmFileset A configuration object that provides the location of the
270
+ * Wasm binary and its loader.
271
+ * @param textClassifierOptions The options for the language detector. Note
272
+ * that either a path to the TFLite model or the model itself needs to be
273
+ * provided (via `baseOptions`).
274
+ */
275
+ static createFromOptions(wasmFileset: WasmFileset, textClassifierOptions: LanguageDetectorOptions): Promise<LanguageDetector>;
276
+ /**
277
+ * Initializes the Wasm runtime and creates a new language detector based on
278
+ * the provided model asset buffer.
279
+ * @export
280
+ * @param wasmFileset A configuration object that provides the location of the
281
+ * Wasm binary and its loader.
282
+ * @param modelAssetBuffer A binary representation of the model.
283
+ */
284
+ static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array): Promise<LanguageDetector>;
285
+ /**
286
+ * Initializes the Wasm runtime and creates a new language detector based on
287
+ * the path to the model asset.
288
+ * @export
289
+ * @param wasmFileset A configuration object that provides the location of the
290
+ * Wasm binary and its loader.
291
+ * @param modelAssetPath The path to the model asset.
292
+ */
293
+ static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<LanguageDetector>;
294
+ private constructor();
295
+ /**
296
+ * Sets new options for the language detector.
297
+ *
298
+ * Calling `setOptions()` with a subset of options only affects those options.
299
+ * You can reset an option back to its default value by explicitly setting it
300
+ * to `undefined`.
301
+ *
302
+ * @export
303
+ * @param options The options for the language detector.
304
+ */
305
+ setOptions(options: LanguageDetectorOptions): Promise<void>;
306
+ /**
307
+ * Predicts the language of the input text.
308
+ *
309
+ * @export
310
+ * @param text The text to process.
311
+ * @return The languages detected in the input text.
312
+ */
313
+ detect(text: string): LanguageDetectorResult;
314
+ }
315
+
316
+ /** Options to configure the MediaPipe Language Detector Task */
317
+ export declare interface LanguageDetectorOptions extends ClassifierOptions, TaskRunnerOptions {
318
+ }
319
+
320
+ /**
321
+ * Copyright 2022 The MediaPipe Authors.
322
+ *
323
+ * Licensed under the Apache License, Version 2.0 (the "License");
324
+ * you may not use this file except in compliance with the License.
325
+ * You may obtain a copy of the License at
326
+ *
327
+ * http://www.apache.org/licenses/LICENSE-2.0
328
+ *
329
+ * Unless required by applicable law or agreed to in writing, software
330
+ * distributed under the License is distributed on an "AS IS" BASIS,
331
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
332
+ * See the License for the specific language governing permissions and
333
+ * limitations under the License.
334
+ */
335
+ /** A language code and its probability. */
336
+ export declare interface LanguageDetectorPrediction {
337
+ /**
338
+ * An i18n language / locale code, e.g. "en" for English, "uz" for Uzbek,
339
+ * "ja"-Latn for Japanese (romaji).
340
+ */
341
+ languageCode: string;
342
+ /** The probability */
343
+ probability: number;
344
+ }
345
+
346
+ /** The result of language detection. */
347
+ export declare interface LanguageDetectorResult {
348
+ /** A list of language predictions. */
349
+ languages: LanguageDetectorPrediction[];
350
+ }
351
+
352
+ /** Base class for all MediaPipe Tasks. */
353
+ declare abstract class TaskRunner {
354
+ protected constructor();
355
+ /** Configures the task with custom options. */
356
+ abstract setOptions(options: TaskRunnerOptions): Promise<void>;
357
+ /**
358
+ * Closes and cleans up the resources held by this task.
359
+ * @export
360
+ */
361
+ close(): void;
362
+ }
363
+
364
+ /** Options to configure MediaPipe Tasks in general. */
365
+ declare interface TaskRunnerOptions {
366
+ /** Options to configure the loading of the model assets. */
367
+ baseOptions?: BaseOptions_2;
368
+ }
369
+
370
+ /** Performs Natural Language classification. */
371
+ export declare class TextClassifier extends TaskRunner {
372
+ /**
373
+ * Initializes the Wasm runtime and creates a new text classifier from the
374
+ * provided options.
375
+ * @export
376
+ * @param wasmFileset A configuration object that provides the location of the
377
+ * Wasm binary and its loader.
378
+ * @param textClassifierOptions The options for the text classifier. Note that
379
+ * either a path to the TFLite model or the model itself needs to be
380
+ * provided (via `baseOptions`).
381
+ */
382
+ static createFromOptions(wasmFileset: WasmFileset, textClassifierOptions: TextClassifierOptions): Promise<TextClassifier>;
383
+ /**
384
+ * Initializes the Wasm runtime and creates a new text classifier based on the
385
+ * provided model asset buffer.
386
+ * @export
387
+ * @param wasmFileset A configuration object that provides the location of the
388
+ * Wasm binary and its loader.
389
+ * @param modelAssetBuffer A binary representation of the model.
390
+ */
391
+ static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array): Promise<TextClassifier>;
392
+ /**
393
+ * Initializes the Wasm runtime and creates a new text classifier based on the
394
+ * path to the model asset.
395
+ * @export
396
+ * @param wasmFileset A configuration object that provides the location of the
397
+ * Wasm binary and its loader.
398
+ * @param modelAssetPath The path to the model asset.
399
+ */
400
+ static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<TextClassifier>;
401
+ private constructor();
402
+ /**
403
+ * Sets new options for the text classifier.
404
+ *
405
+ * Calling `setOptions()` with a subset of options only affects those options.
406
+ * You can reset an option back to its default value by explicitly setting it
407
+ * to `undefined`.
408
+ *
409
+ * @export
410
+ * @param options The options for the text classifier.
411
+ */
412
+ setOptions(options: TextClassifierOptions): Promise<void>;
413
+ /**
414
+ * Performs Natural Language classification on the provided text and waits
415
+ * synchronously for the response.
416
+ *
417
+ * @export
418
+ * @param text The text to process.
419
+ * @return The classification result of the text
420
+ */
421
+ classify(text: string): TextClassifierResult;
422
+ }
423
+
424
+ /** Options to configure the MediaPipe Text Classifier Task */
425
+ export declare interface TextClassifierOptions extends ClassifierOptions, TaskRunnerOptions {
426
+ }
427
+
428
+ /** Classification results of a model. */
429
+ export declare interface TextClassifierResult {
430
+ /** The classification results for each head of the model. */
431
+ classifications: Classifications[];
432
+ /**
433
+ * The optional timestamp (in milliseconds) of the start of the chunk of data
434
+ * corresponding to these results.
435
+ *
436
+ * This is only used for classification on time series (e.g. audio
437
+ * classification). In these use cases, the amount of data to process might
438
+ * exceed the maximum size that the model can process: to solve this, the
439
+ * input data is split into multiple chunks starting at different timestamps.
440
+ */
441
+ timestampMs?: number;
442
+ }
443
+
444
+ /**
445
+ * Performs embedding extraction on text.
446
+ */
447
+ export declare class TextEmbedder extends TaskRunner {
448
+ /**
449
+ * Initializes the Wasm runtime and creates a new text embedder from the
450
+ * provided options.
451
+ * @export
452
+ * @param wasmFileset A configuration object that provides the location of the
453
+ * Wasm binary and its loader.
454
+ * @param textEmbedderOptions The options for the text embedder. Note that
455
+ * either a path to the TFLite model or the model itself needs to be
456
+ * provided (via `baseOptions`).
457
+ */
458
+ static createFromOptions(wasmFileset: WasmFileset, textEmbedderOptions: TextEmbedderOptions): Promise<TextEmbedder>;
459
+ /**
460
+ * Initializes the Wasm runtime and creates a new text embedder based on the
461
+ * provided model asset buffer.
462
+ * @export
463
+ * @param wasmFileset A configuration object that provides the location of the
464
+ * Wasm binary and its loader.
465
+ * @param modelAssetBuffer A binary representation of the TFLite model.
466
+ */
467
+ static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array): Promise<TextEmbedder>;
468
+ /**
469
+ * Initializes the Wasm runtime and creates a new text embedder based on the
470
+ * path to the model asset.
471
+ * @export
472
+ * @param wasmFileset A configuration object that provides the location of the
473
+ * Wasm binary and its loader.
474
+ * @param modelAssetPath The path to the TFLite model.
475
+ */
476
+ static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<TextEmbedder>;
477
+ private constructor();
478
+ /**
479
+ * Sets new options for the text embedder.
480
+ *
481
+ * Calling `setOptions()` with a subset of options only affects those options.
482
+ * You can reset an option back to its default value by explicitly setting it
483
+ * to `undefined`.
484
+ *
485
+ * @export
486
+ * @param options The options for the text embedder.
487
+ */
488
+ setOptions(options: TextEmbedderOptions): Promise<void>;
489
+ /**
490
+ * Performs embeding extraction on the provided text and waits synchronously
491
+ * for the response.
492
+ *
493
+ * @export
494
+ * @param text The text to process.
495
+ * @return The embedding resuls of the text
496
+ */
497
+ embed(text: string): TextEmbedderResult;
498
+ /**
499
+ * Utility function to compute cosine similarity[1] between two `Embedding`
500
+ * objects.
501
+ *
502
+ * [1]: https://en.wikipedia.org/wiki/Cosine_similarity
503
+ *
504
+ * @export
505
+ * @throws if the embeddings are of different types(float vs. quantized), have
506
+ * different sizes, or have an L2-norm of 0.
507
+ */
508
+ static cosineSimilarity(u: Embedding, v: Embedding): number;
509
+ }
510
+
511
+ /** Options to configure the MediaPipe Text Embedder Task */
512
+ export declare interface TextEmbedderOptions extends EmbedderOptions, TaskRunnerOptions {
513
+ }
514
+
515
+ /** Embedding results for a given embedder model. */
516
+ export declare interface TextEmbedderResult {
517
+ /**
518
+ * The embedding results for each model head, i.e. one for each output tensor.
519
+ */
520
+ embeddings: Embedding[];
521
+ /**
522
+ * The optional timestamp (in milliseconds) of the start of the chunk of
523
+ * data corresponding to these results.
524
+ *
525
+ * This is only used for embedding extraction on time series (e.g. audio
526
+ * embedding). In these use cases, the amount of data to process might
527
+ * exceed the maximum size that the model can process: to solve this, the
528
+ * input data is split into multiple chunks starting at different timestamps.
529
+ */
530
+ timestampMs?: number;
531
+ }
532
+
533
+ /**
534
+ * Copyright 2022 The MediaPipe Authors.
535
+ *
536
+ * Licensed under the Apache License, Version 2.0 (the "License");
537
+ * you may not use this file except in compliance with the License.
538
+ * You may obtain a copy of the License at
539
+ *
540
+ * http://www.apache.org/licenses/LICENSE-2.0
541
+ *
542
+ * Unless required by applicable law or agreed to in writing, software
543
+ * distributed under the License is distributed on an "AS IS" BASIS,
544
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
545
+ * See the License for the specific language governing permissions and
546
+ * limitations under the License.
547
+ */
548
+ /** An object containing the locations of the Wasm assets */
549
+ declare interface WasmFileset {
550
+ /** The path to the Wasm loader script. */
551
+ wasmLoaderPath: string;
552
+ /** The path to the Wasm binary. */
553
+ wasmBinaryPath: string;
554
+ /** The optional path to the asset loader script. */
555
+ assetLoaderPath?: string;
556
+ /** The optional path to the assets binary. */
557
+ assetBinaryPath?: string;
558
+ }
559
+
560
+ export { }