Table of Contents

Class SingleTurnConversation

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

A class designed for handling single-turn question answering.
Unlike a multi-turn conversation service, it does not preserve context between questions and answers.

public class SingleTurnConversation : IConversation
Inheritance
SingleTurnConversation
Implements
Inherited Members

Constructors

SingleTurnConversation(LLM)

Creates an instance of the SingleTurnConversation class.

Properties

Grammar

Gets or sets the Grammar object used to enforce grammatical rules during text generation. This ensures controlled and structured output from the model.

LogitBias

A LogitBias object designed to adjust the likelihood of particular tokens (or text chunks) appearing during text completion.

MaximumCompletionTokens

Defines the maximum number of tokens (text chunks) permitted for text completion or generation.

MaximumContextLength

Gets or sets the maximum context length for inputs to the model.

MaximumInputTokens

Specifies the maximum number of tokens allowed as input to the model.

Model

Gets the Model instance associated with this object.

RepetitionPenalty

A RepetitionPenalty object specifying the rules for repetition penalties applied during text completion.

SamplingMode

A SamplingMode object specifying the sampling strategy followed during text completion.

StopSequences

Specifies a set of sequences for which the API will stop generating additional tokens (or text chunks).
The resultant text completion will exclude any occurrence of the specified stop sequences.

SystemPrompt

Specifies the system prompt that is applied to the model before forwarding the user's request.

Methods

Submit(Message, CancellationToken)

Submits a request to the model for text generation.

Submit(string, CancellationToken)

Submits a request to the model for text generation.

SubmitAsync(Message, CancellationToken)

Submits a request to the model for text generation.

SubmitAsync(string, CancellationToken)

Submits a request to the model for text generation.

Events

AfterTextCompletion

This event is triggered following the execution of a text completion.

AfterTokenSampling

This event is triggered just after the generation of a token.
The provided AfterTokenSamplingEventArgs argument enables detailed modifications to be made to the token selection process.

BeforeTokenSampling

This event is triggered just prior to the generation of a token.
The provided BeforeTokenSamplingEventArgs argument allows for precise adjustments to the token sampling process.