Table of Contents

Interface IConversation

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

Represents a conversation interface for interacting with a text generation model. Provides methods for submitting prompts, both synchronously and asynchronously, and allows for event handling before and after token sampling, as well as after text completion.

public interface IConversation

Properties

Grammar

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

Model

Gets the LLM instance associated with this conversation.

RepetitionPenalty

Gets the RepetitionPenalty object that specifies the rules for repetition penalties applied during text completion.

SamplingMode

Gets or sets the TokenSampling object that specifies the sampling strategy used during text completion.

StopSequences

Gets the list of sequences that will cause the API to stop generating additional tokens (or text chunks). The resultant text completion will exclude any occurrences of the specified stop sequences.

SystemPrompt

Gets or sets the system prompt that is applied to the model before processing the user's request.

Methods

Submit(string, CancellationToken)

Submits a prompt to the text generation model and returns the result.

SubmitAsync(string, CancellationToken)

Asynchronously submits a prompt to the text generation model and returns the result.

Events

AfterTextCompletion

Event triggered following the execution of a text completion.

AfterTokenSampling

Event triggered just after the generation of a token. Enables detailed modifications to be made to the token selection process via AfterTokenSamplingEventArgs.

BeforeTokenSampling

Event triggered just before the generation of a token. Allows for precise adjustments to the token sampling process via BeforeTokenSamplingEventArgs.