Classes
| Class | Description |
|---|---|
| FilesetResolver | Resolves the files required for the MediaPipe Task APIs. 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. |
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. |
| TextFormatOptions | Options for formatting a text embedding request. |
Type Aliases
| Type Alias | Description |
|---|---|
| TextEmbeddingType | The type of embedding to generate. This can be used to specify different embedding tasks for models that support it (e.g. Gecko). Supported embedding types are: - 'RETRIEVAL_QUERY': Embeds a query for document retrieval. The input text will be formatted as "task: search result | query: ${text}". - 'RETRIEVAL_DOCUMENT': Embeds a document for semantic retrieval. The input text will be formatted as "title: none | text: ${text}". - 'SEMANTIC_SIMILARITY': Embeds text for semantic similarity. The input text will be formatted as "task: sentence similarity | query: ${text}". - 'CLASSIFICATION': Embeds text for classification. The input text will be formatted as "task: classification | query: ${text}". - 'QUESTION_ANSWERING': Embeds text for question answering. The input text will be formatted as "task: question answering | query: ${text}". - 'CLUSTERING': Embeds text for clustering. The input text will be formatted as "task: clustering | query: ${text}". - 'FACT_CHECKING': Embeds text for fact checking. The input text will be formatted as "task: fact checking | query: ${text}". - 'CODE_RETRIEVAL': Embeds text for code retrieval. The input text will be formatted as "task: code retrieval | query: ${text}". |
| TextRole | The role of the text to be embedded. Supported roles are: - 'QUERY': The text is a query. - 'DOCUMENT': The text is a document. |
TextEmbeddingType {#textembeddingtype}
The type of embedding to generate. This can be used to specify different embedding tasks for models that support it (e.g. Gecko). Supported embedding types are: - 'RETRIEVAL_QUERY': Embeds a query for document retrieval. The input text will be formatted as "task: search result | query: ${text}". - 'RETRIEVAL_DOCUMENT': Embeds a document for semantic retrieval. The input text will be formatted as "title: none | text: ${text}". - 'SEMANTIC_SIMILARITY': Embeds text for semantic similarity. The input text will be formatted as "task: sentence similarity | query: ${text}". - 'CLASSIFICATION': Embeds text for classification. The input text will be formatted as "task: classification | query: ${text}". - 'QUESTION_ANSWERING': Embeds text for question answering. The input text will be formatted as "task: question answering | query: ${text}". - 'CLUSTERING': Embeds text for clustering. The input text will be formatted as "task: clustering | query: ${text}". - 'FACT_CHECKING': Embeds text for fact checking. The input text will be formatted as "task: fact checking | query: ${text}". - 'CODE_RETRIEVAL': Embeds text for code retrieval. The input text will be formatted as "task: code retrieval | query: ${text}".
Signature:
export declare type TextEmbeddingType = "RETRIEVAL_QUERY" | "RETRIEVAL_DOCUMENT" | "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "QUESTION_ANSWERING" | "CLUSTERING" | "FACT_CHECKING" | "CODE_RETRIEVAL";
TextRole {#textrole}
The role of the text to be embedded. Supported roles are: - 'QUERY': The text is a query. - 'DOCUMENT': The text is a document.
Signature:
export declare type TextRole = "QUERY" | "DOCUMENT";