Table of Contents

Class AfterTokenSamplingEventArgs

Namespace
LMKit.TextGeneration.Events
Assembly
LM-Kit.NET.dll

Provides details for the event that occurs after a token sampling operation.

public sealed class AfterTokenSamplingEventArgs : EventArgs
Inheritance
AfterTokenSamplingEventArgs
Inherited Members

Properties

KeepLast

Gets or sets a value indicating whether the last generated token should be included in the response when the text completion process is terminated prematurely. This property is relevant only if Stop is set to true. The default value is false.

Model

Gets the language model (LLM) instance associated with this event.

Perplexity

Gets the perplexity of the model's predictions up to this point. Lower perplexity indicates better predictive performance.

Stop

Gets or sets a value indicating whether the text completion process should be terminated prematurely. The default value is false.

TextChunk

Gets the text representation of the currently selected token.

Token

Gets or sets the identifier of the selected token for text completion. Initially determined by the sampling engine, but can be adjusted if necessary.

TokenProbability

Gets the probability of the selected token, ranging from 0 to 1. A higher value indicates a higher likelihood.

Methods

GetTokenCandidateByRank(int)

Retrieves the identifier of a token based on its rank in terms of likelihood of occurrence.

GetTokenCandidateProbability(int)

Retrieves the probability of occurrence for a given token. This method evaluates the likelihood of a specific token being the next in the sequence, based on the model's current predictions.

GetTokenCandidateProbabilityByRank(int)

Retrieves the probability of a token based on its rank in terms of likelihood of occurrence.

GetTokenCandidateTextChunkByRank(int)

Retrieves the text representation of a token based on its rank in terms of likelihood of occurrence.