Table of Contents

Namespace LMKit.TextGeneration

Namespaces

LMKit.TextGeneration.Chat
LMKit.TextGeneration.Events
LMKit.TextGeneration.Sampling

Classes

MultiTurnConversation

High-level, production-ready conversation runtime for multi-turn chat.

MultiTurnConversation wraps a local language model and maintains the running conversation state (messages, system prompt, tool-calls, memory recall, etc.). It exposes a compact API to:

  • submit user prompts (sync/async),
  • regenerate or continue the last assistant answer,
  • register model-callable tools and control per-turn tool policy,
  • inject long-term AgentMemory and cap recall tokens,
  • configure sampling (temperature/top-p/etc.) and repetition penalties,
  • enforce structure with Grammar (mutually exclusive with tools),
  • and persist/restore full chat sessions.

Threading model: generation operations are serialized internally so only one call runs at a time. Create one instance per independent conversation. Share the underlying LM across conversations if desired.

SingleTurnConversation

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

Summarizer

Provides functionality to generate a summary (title and/or content) from various input sources using a language model.

Summarizer.SummarizerResult

Represents the result of a summarization operation, including both a title and summarized content.

TextGenerationResult

Holds the result of a text completion operation.

Interfaces

IConversation

Represents a conversation interface for interacting with a text generation model. Provides methods for submitting prompts (sync/async), and exposes lifecycle events for token sampling and completion post-processing. Also surfaces key configuration controls, including system prompt, sampling strategy, repetition penalties, and reasoning-level controls.

IMultiTurnConversation

Represents a multi-turn conversation interface that extends IConversation with tool-calling, skills, long-term memory, session persistence, and chat history management.

ITextGenerationSettings

Represents the settings used to control text generation behavior. This includes specifying the sampling strategy, repetition penalties, stop sequences, and optional grammar enforcement for structured and controlled output.

Enums

Language

Defines supported languages.

Summarizer.OverflowResolutionStrategy

Specifies the strategies available for handling scenarios where the combined length of the input text and the anticipated completion tokens exceed the configured MaximumContextLength.

Summarizer.SummarizationIntent

Defines the type of summarization intent to apply when processing a given input.

TextGenerationResult.StopReason

Enumerates the various reasons that can lead to the termination of a text completion task.