Table of Contents

Class ConversationOptionalArgs

public sealed class ConversationOptionalArgs : LiteRTLMNativeHandle
Inheritance
object
ConversationOptionalArgs
Inherited Members

Constructors

ConversationOptionalArgs()

Creates a managed wrapper around the optional arguments for conversation APIs. The caller is responsible for disposing the wrapper using Dispose().

public ConversationOptionalArgs()

Exceptions

InvalidOperationException

Thrown if the native object could not be created.

Methods

ReleaseUnmanagedResources()

protected override void ReleaseUnmanagedResources()

SetConstraint(ConstraintType, string)

Sets the constraint for the conversation optional args.

public void SetConstraint(ConstraintType constraintType, string constraintString)

Parameters

constraintType ConstraintType

The type of constraint.

constraintString string

The constraint pattern/schema/grammar string.

SetMaxOutputTokens(int)

Sets the maximum number of output tokens for the conversation optional arguments.

public void SetMaxOutputTokens(int maxOutputTokens)

Parameters

maxOutputTokens int

The maximum number of output tokens.

SetNoRepeatNgramConfig(NoRepeatNgramConfig?)

Sets the no repeat ngram configuration for the per-turn conversation optional arguments.

public void SetNoRepeatNgramConfig(NoRepeatNgramConfig? noRepeatNgramConfig)

Parameters

noRepeatNgramConfig NoRepeatNgramConfig

The no repeat ngram configuration. The contents are deep-copied when set. If null, clears any previously set no repeat ngram config so no repeat ngram banning applies.

Remarks

The configured parameters (no_repeat_ngram_size, window_size) apply exclusively to the output sequence generated during the current SendMessage(string, string?, ConversationOptionalArgs?) or SendMessageStream(StreamCallback, string, string?, ConversationOptionalArgs?) call.

SetRepetitionPenaltyConfig(RepetitionPenaltyConfig?)

Sets the repetition penalty configuration for the per-turn conversation optional arguments.

public void SetRepetitionPenaltyConfig(RepetitionPenaltyConfig? repetitionPenaltyConfig)

Parameters

repetitionPenaltyConfig RepetitionPenaltyConfig

The repetition penalty configuration. The contents are deep-copied when set. If null, clears any previously set repetition penalty config so no penalties apply.

Remarks

The configured penalties (repetition_penalty, presence_penalty, frequency_penalty, window_size) apply exclusively to the output sequence generated during the current SendMessage(string, string?, ConversationOptionalArgs?) or SendMessageStream(StreamCallback, string, string?, ConversationOptionalArgs?) call.

SetSuppressTokensConfig(SuppressTokensConfig?)

Sets the suppress tokens configuration for the per-turn conversation optional arguments.

public void SetSuppressTokensConfig(SuppressTokensConfig? suppressTokensConfig)

Parameters

suppressTokensConfig SuppressTokensConfig

The suppress tokens configuration. The contents are deep-copied when set. If null or if the inner token set is disabled/empty, clears any previously set suppress tokens config so no token suppression applies.

Remarks

The configured list of suppressed tokens applies exclusively to the output sequence generated during the current SendMessage(string, string?, ConversationOptionalArgs?) or SendMessageStream(StreamCallback, string, string?, ConversationOptionalArgs?) call.

SetThinkingConfig(ThinkingConfig?)

Sets the thinking config for the conversation optional args.

public void SetThinkingConfig(ThinkingConfig? thinkingConfig)

Parameters

thinkingConfig ThinkingConfig

The thinking config to set. If null, clears any previously set thinking config.

SetVisualTokenBudget(int)

Sets the visual token budget for the conversation optional arguments.

public void SetVisualTokenBudget(int visualTokenBudget)

Parameters

visualTokenBudget int

The visual token budget.