TextEmbedder.TextEmbedderOptions

public abstract class TextEmbedder.TextEmbedderOptions extends TaskOptions


Options for setting up a TextEmbedder.

Summary

Nested types

Builder for TextEmbedderOptions.

Public constructors

Public methods

abstract BaseOptions

The BaseOptions for the text embedder task.

static TextEmbedder.TextEmbedderOptions.Builder

Instantiates a builder for TextEmbedderOptions.

CalculatorOptionsProto.CalculatorOptions

Converts a TextEmbedderOptions to a CalculatorOptions protobuf message.

abstract boolean

Whether L2 normalization should be performed on the returned embeddings.

abstract boolean

Whether the returned embedding should be quantized to bytes via scalar quantization.

Inherited methods

From com.google.mediapipe.tasks.core.TaskOptions
BaseOptionsProto.BaseOptions

Converts a BaseOptions instance to a BaseOptionsProto.BaseOptions protobuf message.

BaseOptionsProto.BaseOptions
convertBaseOptionsToProto(BaseOptions options, boolean useLiteRt)

Converts a BaseOptions instance to a BaseOptionsProto.BaseOptions protobuf message, optionally routing inference through the LiteRT backend.

Any

Converts a MediaPipe Tasks task-specific options to an proto3 Any message.

Public constructors

TextEmbedderOptions

public TextEmbedderOptions()

Public methods

baseOptions

public abstract BaseOptions baseOptions()

The BaseOptions for the text embedder task.

builder

public static TextEmbedder.TextEmbedderOptions.Builder builder()

Instantiates a builder for TextEmbedderOptions.

convertToCalculatorOptionsProto

public CalculatorOptionsProto.CalculatorOptions convertToCalculatorOptionsProto()

Converts a TextEmbedderOptions to a CalculatorOptions protobuf message.

l2Normalize

public abstract boolean l2Normalize()

Whether L2 normalization should be performed on the returned embeddings. Use this option only if the model does not already contain a native L2_NORMALIZATION TF Lite Op. In most cases, this is already the case and L2 norm is thus achieved through TF Lite inference.

quantize

public abstract boolean quantize()

Whether the returned embedding should be quantized to bytes via scalar quantization. Embeddings are implicitly assumed to be unit-norm and therefore any dimension is guaranteed to have a value in [-1.0, 1.0]. Use the l2_normalize option if this is not the case.