tasks-text package

Classes

Class Description
FilesetResolver Resolves the files required for the MediaPipe Task APIs.This class verifies whether SIMD is supported in the current environment and loads the SIMD files only if support is detected. The returned filesets require that the Wasm files are published without renaming. If this is not possible, you can invoke the MediaPipe Tasks APIs using a manually created WasmFileset.
LanguageDetector Predicts the language of an input text.
TextClassifier Performs Natural Language classification.
TextEmbedder Performs embedding extraction on text.
TextProofreader Performs text proofreading and grammar correction on input text.
TextSummarizer Performs text summarization on input text.

Interfaces

Interface Description
Category A classification category.
Classifications Classification results for a given classifier head.
Embedding List of embeddings with an optional timestamp.One and only one of the two 'floatEmbedding' and 'quantizedEmbedding' will contain data, based on whether or not the embedder was configured to perform scalar quantization.
LanguageDetectorOptions Options to configure the MediaPipe Language Detector Task
LanguageDetectorPrediction A language code and its probability.
LanguageDetectorResult The result of language detection.
TextClassifierOptions Options to configure the MediaPipe Text Classifier Task
TextClassifierResult Classification results of a model.
TextEmbedderOptions Options to configure the MediaPipe Text Embedder Task
TextEmbedderResult Embedding results for a given embedder model.
TextEmbeddingFormatContext Formatting context options for task-specific text embeddings (also exported as TextFormatOptions).
TextProofreaderCorrection A single proofreading diff segment (also exported as Correction).
TextProofreaderOptions Options to configure the MediaPipe Text Proofreader Task.
TextProofreaderResult The proofreading result containing the corrected text and fine-grained diff segments.
TextSummarizerOptions Options to configure the MediaPipe Text Summarizer Task.

Type Aliases

Type Alias Description
TextEmbeddingTextRole Role of the text when formatting embeddings ('QUERY' or 'DOCUMENT'; also exported as TextRole).
TextEmbeddingType Task type for formatting text embeddings (such as 'RETRIEVAL_QUERY', 'RETRIEVAL_DOCUMENT', 'SEMANTIC_SIMILARITY', etc.).
TextProofreaderCorrectionType Edit operation type for a proofreading diff segment ('SAME', 'INSERTION', or 'DELETION'; also exported as CorrectionType).
TextSummarizerMode Summarization style mode ('TLDR' or 'KEYPOINTS'; also exported as SummarizationMode).
TextSummarizerResult The summarized text output returned by TextSummarizer.