TextEmbedder.TextEmbedderOptions.Builder

public abstract class TextEmbedder.TextEmbedderOptions.Builder


Builder for TextEmbedderOptions.

Summary

Public constructors

Public methods

abstract TextEmbedder.TextEmbedderOptions

Builds a TextEmbedderOptions instance.

abstract TextEmbedder.TextEmbedderOptions.Builder

Sets the base options for the text embedder task.

abstract TextEmbedder.TextEmbedderOptions.Builder
setL2Normalize(boolean l2Normalize)

Sets whether L2 normalization should be performed on the returned embeddings.

abstract TextEmbedder.TextEmbedderOptions.Builder
setQuantize(boolean quantize)

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

Public constructors

Builder

public Builder()

Public methods

build

public abstract TextEmbedder.TextEmbedderOptions build()

Builds a TextEmbedderOptions instance.

setBaseOptions

public abstract TextEmbedder.TextEmbedderOptions.Builder setBaseOptions(BaseOptions value)

Sets the base options for the text embedder task.

setL2Normalize

public abstract TextEmbedder.TextEmbedderOptions.Builder setL2Normalize(boolean l2Normalize)

Sets 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.

False by default.

setQuantize

public abstract TextEmbedder.TextEmbedderOptions.Builder setQuantize(boolean quantize)

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

False by default.