Table of Contents

Class LiteRtEmbeddingOptions

Namespace
LiteRtLmSharp
Assembly
LiteRtLmSharp.dll

Per-call options for LiteRtEmbeddingEngine. Unset values use the runtime defaults.

public sealed record LiteRtEmbeddingOptions : IEquatable<LiteRtEmbeddingOptions>
Inheritance
LiteRtEmbeddingOptions
Implements
Inherited Members

Properties

InsertSpecialTokens

Gets a value indicating whether the runtime inserts the model's special tokens (such as BOS and EOS) around the input, or null for the runtime default (true).

public bool? InsertSpecialTokens { get; init; }

Property Value

bool?

Normalize

Gets a value indicating whether the vector is L2-normalized, or null for the runtime default (true). Normalized vectors make cosine similarity a dot product.

public bool? Normalize { get; init; }

Property Value

bool?

OutputDimensions

Gets the length to truncate the vector to, or null (default) for the model's full length. Models trained with Matryoshka representation learning keep most of their quality when truncated to their trained sizes (EmbeddingGemma 2: 768, 512, 256 or 128); the runtime normalizes after truncating unless Normalize is false. A value above the model's length fails the call with InvalidArgument.

public int? OutputDimensions { get; init; }

Property Value

int?

Exceptions

ArgumentOutOfRangeException

The value is zero or negative.

OverflowStrategy

Gets how the runtime handles a text longer than the largest loaded signature (see MaxInputLength), or null for the runtime default, Error (the call fails with InvalidArgument).

public LiteRtInputOverflowStrategy? OverflowStrategy { get; init; }

Property Value

LiteRtInputOverflowStrategy?