AI-PoweredText Generation for .NET
Generate structured content, summaries, corrections, and style transformations with on-device LLMs. Grammar-constrained outputs, Dynamic Sampling technology, multimodal support, and reasoning capabilities. 100% local processing, zero cloud dependency.
Elevate .NET Apps with AI-Powered Text Generation
LM-Kit.NET brings cutting-edge AI-driven text generation directly to your .NET applications. Generate coherent, contextually relevant text across various domains - from structured content creation and summarization to grammar correction and text enhancement. By leveraging compact Large Language Models (LLMs) that run entirely on-device, LM-Kit ensures fast, secure, and private processing without the need for cloud services.
Powered by Dynamic Sampling technology, LM-Kit achieves up to 75% error reduction and 2x faster inference speeds. With support for grammar-constrained outputs, multimodal inputs, and reasoning capabilities, you can build sophisticated text generation pipelines that meet enterprise requirements.
New in 2026: Agent templates for text generation tasks including WriterAgentTemplate, EditorAgentTemplate, and SummarizerAgentTemplate. Build agentic text generation workflows with planning strategies and tool integration.
Dynamic Sampling
Proprietary technology ensuring accurate, constrained outputs with optimal performance.
Multimodal Support
Generate text from images, documents, and attachments with VLM integration.
Reasoning Capabilities
Chain-of-thought prompting and intermediate reasoning steps with ReasoningLevel control.
100% Local
On-device inference with no cloud dependency. Your data never leaves your infrastructure.
Grammar-Constrained Text Generation
Generate outputs that strictly conform to predefined formats using custom grammars, JSON schemas, and BNF definitions. Powered by Dynamic Sampling technology for up to 75% error reduction.
JSON Schema Enforcement
Create Grammar objects from JSON schemas to ensure generated content aligns with structure and data types. Build JSON outputs directly from .NET types including complex structures like dates and arrays.
BNF Grammar Definitions
Define custom grammars using Backus-Naur Form (BNF) for domain-specific output formats. Enforce exact syntax requirements for code generation, queries, and structured documents.
TextExtractionElement
Define extraction schemas with typed elements including String, Float, Date, Boolean, and Arrays. Supports formatting hints, case modes, and required field validation.
Predefined Grammar Types
Use built-in grammars for common formats: Json, JsonArray, Arithmetic, List, and Boolean. Rapid prototyping with zero grammar definition required.
Whitelisted Values
Constrain outputs to specific allowed values using the WhitelistedValues property. Perfect for classification tasks and controlled vocabulary generation.
Schema Discovery
Automatically discover extraction schemas from unstructured content using SchemaDiscovery. Let the AI identify relevant fields and data types.
Grammar.CreateJsonGrammarFromJsonScheme()
Create a Grammar object from a JSON schema string to enforce structured JSON output generation.
View DocumentationGrammar.CreateJsonGrammarFromExtractionElements()
Build grammar from TextExtractionElement collection for typed data extraction with validation.
View DocumentationGrammar.CreateGrammarFromStringList()
Generate grammar from a list of allowed string values for constrained classification outputs.
View DocumentationGrammar.CreateJsonGrammarFromFields()
Create JSON grammar from field definitions for rapid schema development without full JSON schema.
View Documentationusing LMKit.Model; using LMKit.TextGeneration; using LMKit.TextGeneration.Sampling; using LMKit.Extraction; // Load the model var model = LM.LoadFromModelID("qwen3:4b"); // Define extraction elements for structured output var elements = new List<TextExtractionElement> { new TextExtractionElement("ProductName", ElementType.String, "Name of the product"), new TextExtractionElement("Price", ElementType.Float, "Price in USD"), new TextExtractionElement("ReleaseDate", ElementType.Date, "Product release date"), new TextExtractionElement("Features", ElementType.StringArray, "List of key features") }; // Create grammar from extraction elements var grammar = Grammar.CreateJsonGrammarFromExtractionElements(elements); // Create conversation with grammar constraint var chat = new SingleTurnConversation(model) { Grammar = grammar }; // Generate structured output var result = chat.Submit("Extract product info: The SuperWidget Pro costs $299.99 and launches March 15, 2026."); Console.WriteLine(result.Completion);
Intelligent Text Condensation
Condense lengthy texts into concise, informative summaries. Extract key insights from any content size with adaptive overflow strategies and multilingual support.
Adaptive Summarization Engine
The LM-Kit Summarizer is a sophisticated NLP engine that employs innovative techniques to condense content of any size or language into coherent summaries. Multiple overflow strategies ensure reliable handling of massive inputs, from short articles to lengthy legal documents.
Overflow Resolution Strategies
- Truncate: Process the first portion that fits within context limits
- RecursiveSummarize: Iteratively summarize chunks then combine
- Reject: Return error for content exceeding limits
- Automatic title generation with GenerateTitle property
- Configurable summary length via MaxContentWords
- Target language detection and generation
- Multimodal support - summarize from images
- Confidence score for quality assessment
Briefing
Executive-style condensed overview
SummarizationIntentKey Points
Extract main takeaways
SummarizationIntentAbstract
Academic-style summary
SummarizationIntentCustom
Your defined intent
SummarizationIntentusing LMKit.Model; using LMKit.TextGeneration; var model = LM.LoadFromModelID("mistral-small3.2"); var summarizer = new Summarizer(model) { GenerateTitle = true, GenerateContent = true, MaxContentWords = 150, OverflowStrategy = OverflowResolutionStrategy.RecursiveSummarize, TargetLanguage = Language.English }; var result = summarizer.Summarize( File.ReadAllText("annual-report.txt")); Console.WriteLine($"Title: {result.Title}"); Console.WriteLine($"Summary: {result.Content}");
AI-Powered Text Quality Enhancement
Identify and correct grammatical errors, typos, and inconsistencies. Real-time feedback for professional, polished content across multiple languages.
Grammar Correction
Fix subject-verb agreement, tense inconsistencies, and sentence structure issues automatically.
Spell Checking
Detect and correct spelling mistakes with context-aware suggestions.
Multilingual Support
Correct text in multiple languages with language-specific rules and conventions.
Real-Time Processing
Instant corrections as users type with async support for responsive applications.
using LMKit.Model; using LMKit.TextEnhancement; var model = LM.LoadFromModelID("qwen3:4b"); var corrector = new TextCorrection(model); string input = "My cat don't never flyed to the moon " + "because he too much tired from baking pizza."; string corrected = corrector.Correct(input); Console.WriteLine("Original: " + input); Console.WriteLine("Corrected: " + corrected); // Output: "My cat has never flown to the moon // because he was too tired from baking pizza." // Async support for real-time applications var asyncResult = await corrector.CorrectAsync(input);
Style Transformation & Tone Adaptation
Transform text into various communication styles while preserving meaning and structure. Tailor content for different audiences with predefined and custom styles.
Concise
Clear, direct communication
Professional
Business-appropriate tone
Friendly
Warm, approachable style
Custom
Define your own style
Brand Consistency
Ensure all communications align with your brand voice and style guidelines across different platforms.
Language Adaptation
Translate and rewrite text while maintaining context and nuance for global audiences.
Audience Targeting
Tailor content to resonate with specific audience segments, improving engagement.
Async Processing
Asynchronous support for efficient, real-time rewriting in dynamic applications.
using LMKit.Model; using LMKit.TextEnhancement; var model = LM.LoadFromModelID("qwen3:4b"); var rewriter = new TextRewriter(model); string casual = "Hey! So basically the project's done and it works great!"; // Transform to professional style string professional = rewriter.Rewrite(casual, WritingStyle.Professional); Console.WriteLine("Professional: " + professional); // "The project has been completed successfully and is functioning as expected." // Transform to concise style string concise = rewriter.Rewrite(casual, WritingStyle.Concise); Console.WriteLine("Concise: " + concise); // "Project complete. Fully operational."
Get Started with Examples
Explore working code samples demonstrating text generation capabilities.
Web Content Extractor
Extract and summarize web page information to structured JSON using grammar constraints.
Text Summarizer
Condense lengthy text into concise summaries with optional title generation.
Key Classes & Methods
Core components for building text generation pipelines.
SingleTurnConversation
One-shot text generation with grammar constraints, system prompts, and sampling configuration.
View DocumentationMultiTurnConversation
Context-aware chat with memory, tools, skills, and reasoning support.
View DocumentationSummarizer
Intelligent text condensation with overflow strategies and multilingual support.
View DocumentationGrammar
Grammar-constrained output with BNF, JSON schema, and extraction element support.
View DocumentationTextCorrection
Grammar and spelling correction with real-time feedback and async support.
View DocumentationKeywordExtraction
Extract key terms and topics with configurable count and target language.
View DocumentationTextExtraction
Extract structured data from unstructured content with schema definition.
View DocumentationReady to Build AI-Powered Text Generation?
Full control over content creation, summarization, and enhancement. 100% local, 100% your infrastructure.