Intelligent Chatbotsfor .NET Applications.
Build chatbots that maintain context across turns, recall relevant facts from memory, and execute functions on demand. Run Qwen, Gemma, Mistral, DeepSeek, GLM, GPT-OSS and more entirely on-device with zero cloud dependency, full data privacy, and predictable latency. Powered by MultiTurnConversation and AgentMemory APIs.
Why LM-Kit Conversational AI?
Building chatbots that maintain context, remember users, and take actions has traditionally required complex orchestration of multiple cloud services and custom infrastructure. LM-Kit unifies all of this into a single, on-device SDK.
With MultiTurnConversation and AgentMemory, your chatbots can engage in extended dialogues, recall relevant facts across sessions, and invoke your application's functions directly, all while keeping sensitive data within your controlled environment.
Introducing AgentMemory Blog PostKey Features
Multi-Turn Context
Maintain conversation history across exchanges. The model references past turns for coherent, contextual responses.
RAG-Backed Memory
AgentMemory stores semantic, episodic, and procedural knowledge. Recall is KV-cache aware for grounded outputs.
Function Calling
Let chatbots invoke your C# methods dynamically. Define tools with [LMFunction] or ITool interface.
Streaming Output
Real-time token streaming for responsive UX. Display responses as they generate for natural conversation flow.
Session Persistence
Save and restore conversation state to disk. Resume sessions across app restarts with full context preserved.
Structured JSON
Constrain responses to valid JSON schemas. Get predictable, parseable outputs for data extraction.
Vision Support
Process images alongside text with VLM-capable models. Build visual assistants that describe and analyze images.
On-Device Privacy
All inference runs locally. Conversations never leave your environment. HIPAA and GDPR ready.
Conversation APIs
Choose the right conversation pattern for your use case, from fast Q&A to extended dialogues with history and tool calling.
Single-Turn Conversation
Fast question-answer interactions without history retention. Optimized for stateless queries, classification tasks, and one-shot completions.
Multi-Turn Conversation
Extended dialogues with full history tracking. Built for chatbots, assistants, and interactive workflows that span multiple exchanges.
Smart Memories
Keep conversations coherent with RAG-backed memory that recalls relevant facts only when needed, without polluting context with irrelevant information.
Agents That Remember What Matters
AgentMemory integrates with MultiTurnConversation to store and recall semantic, episodic, and procedural knowledge across sessions. Memory is KV-cache aware, injecting only missing context to keep outputs grounded without repetition.
The memory system supports three types modeled after human cognitive memory, enabling agents to remember facts, events, and procedures relevant to each conversation.
Semantic Memory
Store facts, definitions, and general knowledge. User preferences, product details, domain expertise.
Episodic Memory
Remember specific events and interactions. User history, support tickets, conversation milestones.
Procedural Memory
Retain learned procedures and workflows. Remember how users like things done.
KV-Cache Aware Recall
Memory injection is optimized for the model's key-value cache. Only missing context is added.
Smart Filtering
Use DataFilter to exclude collections or sections. Apply domain rules via metadata filtering.
Serialize & Restore
Persist memory to disk and reload across sessions. Share memory states between agents.
On-Device Privacy
All memory operations run locally. Embeddings and vector search stay within your environment.
Function Calling & Tool Use
Let chatbots call your code dynamically. Define functions with JSON Schema, and the model decides when and how to invoke them.
[LMFunction] Attribute
Decorate C# methods with [LMFunction] to expose them as callable tools. The SDK generates JSON Schema automatically from method signatures and XML documentation.
ITool Interface & MCP
Implement ITool for custom tool definitions or connect to external tool catalogs via Model Context Protocol (MCP). Full control over validation and error handling.
Execution Modes
Simple
One function call per turn with sequential execution.
Multiple
Chain multiple calls in sequence within a single turn.
Parallel
Execute independent calls concurrently for speed.
Parallel + Multiple
Combine parallel and sequential chaining.
Built for Developer Velocity
LM-Kit simplifies integration with a single, unified API. No boilerplate. No rework when switching models.
using LMKit.Model; using LMKit.TextGeneration; // Instantiate a model by ID from the catalog var model = LM.LoadFromModelID("qwen3-8b"); // Create a multi-turn conversation with system prompt var chat = new MultiTurnConversation(model) { SystemPrompt = "You are a helpful customer support agent." }; // First turn var response1 = chat.Submit("What's your return policy?"); Console.WriteLine(response1.Completion); // Second turn - context is automatically maintained var response2 = chat.Submit("How long do I have?"); Console.WriteLine(response2.Completion);
using LMKit.Model; using LMKit.Agents; using LMKit.TextGeneration; // Load chat and embedding models var chatModel = LM.LoadFromModelID("qwen3-8b"); var embedModel = LM.LoadFromModelID("bge-small-en"); // Create persistent memory var memory = new AgentMemory(embedModel); // Store user preferences await memory.SaveInformationAsync( "user_prefs", "User prefers concise responses.", "style", MemoryType.Semantic); // Create conversation with memory attached var chat = new MultiTurnConversation(chatModel) { Memory = memory }; // Memory is recalled automatically when relevant var response = chat.Submit("Explain dependency injection.");
using LMKit.Model; using LMKit.TextGeneration; using LMKit.FunctionCalling; public class WeatherTools { [LMFunction("Get current weather for a city")] public static string GetWeather(string city) { return $"Weather in {city}: 72°F, sunny"; } } var model = LM.LoadFromModelID("qwen3-8b"); var chat = new MultiTurnConversation(model); // Register tools from a class chat.Tools.ImportFunctions(typeof(WeatherTools)); // Model calls GetWeather when appropriate var response = chat.Submit("What's the weather in Tokyo?");
Explore Usage Examples
Multi-Turn Chat
Interactive chatbot with context retention, model selection, and response regeneration.
View Sample ConsolePersistent Session
Save and restore conversation state to disk. Resume sessions across app restarts.
View Sample ConsoleChat with Tools
Function calling in action. Register C# methods and let the model invoke them.
View Sample ConsoleChat with Vision
Process images alongside text using VLMs. Build visual assistants.
View Sample MAUI AppChat Playground
Full-featured chat UI with model switching, history management, and settings.
View Sample ConsoleRAG Chatbot
Retrieval-augmented generation over your documents. Chat with eBooks and PDFs.
View SampleCommon Use Cases
Customer Support
Deploy chatbots that handle complex queries, remember customer history, and call your ticketing APIs.
Healthcare Companions
Build virtual assistants for patient triage, scheduling, and follow-ups with HIPAA-compliant on-device processing.
Educational Tutors
Create intelligent tutoring systems that adapt to student level and remember progress across sessions.
E-commerce Assistants
Power product discovery, order tracking, and recommendations. Integrate with inventory and shipping APIs.
Legal & Compliance
Build document Q&A systems for contracts, policies, and regulations. Keep sensitive data on-premises.
Enterprise Knowledge
Deploy chatbots that answer questions from internal wikis, Confluence, or SharePoint without cloud dependency.
Start Building Today
Explore our docs, try the demos, or integrate instantly with LM-Kit.NET's SDK.
Talk to an Expert
Need help with integration, model selection, or memory workflows? Let's connect.
Speak with an expert