Table of Contents

Class LiteRtSendOptions

Namespace
LiteRtLmSharp
Assembly
LiteRtLmSharp.dll

Per-send options for Send(string, IReadOnlyList<LiteRtAttachment>?, LiteRtSendOptions?) and its async/streaming variants. Everything here applies to one send, overriding the conversation-level setting where one exists; pass null (the default) to use the conversation's configuration unchanged.

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

Remarks

This is also the growth point for per-send settings future native versions add (e.g. a per-send output-token cap), so they can land without changing the send signatures. Maps to the C API's per-send conversation_optional_args.

Properties

Constraint

Output constraint (regex / JSON Schema) enforced during this send's sampling. Requires the conversation to have been created with ConstraintProvider set — without a provider the send throws LiteRtException. null (default) = unconstrained. Requires native LiteRT-LM v0.15.0+.

public LiteRtConstraint? Constraint { get; init; }

Property Value

LiteRtConstraint

Remarks

The constraint masks every generated token to pattern-conforming continuations, so on a conversation with Tools a constrained send cannot emit a tool call — the model is forced into the pattern instead. Constrain only the sends whose reply must match the pattern; run tool rounds unconstrained.

EnableThinking

Per-send thinking override: true/false turns the model's reasoning mode on/off for this send only, overriding the conversation-level EnableThinking. null (default) = inherit the conversation-level value. Requires native LiteRT-LM v0.15.0+.

public bool? EnableThinking { get; init; }

Property Value

bool?

Remarks

The native per-send thinking config replaces the conversation-level one wholesale, so the binding composes it: an unset field inherits the conversation-level value before the config is built (a raw enable_thinking key set only via ExtraContext is not visible to this composition — prefer the typed EnableThinking).

MaxOutputTokens

Maximum output tokens for this one send. 0 (default) = inherit the conversation-level MaxOutputTokens (whose own 0 means the engine default). When positive it overrides that conversation-level cap for this send only.

public int MaxOutputTokens { get; init; }

Property Value

int

Remarks

Maps to the C API conversation_optional_args_set_max_output_tokens. This is the same underlying decode cap as the conversation-level setting, applied at per-send granularity: the native runtime resolves the effective cap as the per-send value when present, otherwise the session's value (session_advanced.cc). Unlike the conversation-level setting, it does not create a session config, so it never changes multimodal encoder loading.

NoRepeatNgram

Bans this send's decode from repeating n-grams it already produced. null (default) = no ban. Requires native LiteRT-LM v0.15.0+.

public LiteRtNoRepeatNgramOptions? NoRepeatNgram { get; init; }

Property Value

LiteRtNoRepeatNgramOptions

RepetitionPenalties

Repetition penalties (multiplicative and/or subtractive) applied to this send's decode. null (default) = none. Requires native LiteRT-LM v0.15.0+.

public LiteRtRepetitionPenaltyOptions? RepetitionPenalties { get; init; }

Property Value

LiteRtRepetitionPenaltyOptions

SuppressTokens

Token ids banned from this send's decode: every listed id's logit is forced to -inf on each step. null/empty (default) = none. Find ids with Tokenize(string) (note most words tokenize differently with/without a leading space). The list is copied at initialization (later mutation of the source list has no effect) and ids must be non-negative; out-of-vocabulary ids are ignored by the native layer (bounds-checked there). Requires native LiteRT-LM v0.15.0+.

public IReadOnlyList<int>? SuppressTokens { get; init; }

Property Value

IReadOnlyList<int>

Exceptions

ArgumentOutOfRangeException

Any id is negative.

ThinkingTokenBudget

Per-send thinking token budget, overriding the conversation-level ThinkingTokenBudget for this send. null (default) = inherit the conversation-level value; -1 = explicitly infinite; 0 is treated by the native layer as "no budget". A budget on a send whose effective EnableThinking is unset at both levels implies thinking ON for that send. Requires native LiteRT-LM v0.15.0+.

public int? ThinkingTokenBudget { get; init; }

Property Value

int?

Exceptions

ArgumentOutOfRangeException

The value is negative and not -1.

VisualTokenBudget

Budget (in tokens) that image attachments in this send may consume during prefill. 0 (default) = inherit VisualTokenBudget (whose own 0 means the engine default). Only meaningful when the send carries image attachments.

public int VisualTokenBudget { get; init; }

Property Value

int