What You Can Build with LM-Kit.NET
Standalone .NET samples across multiple capability areas. Every sample runs entirely on your machine with no cloud API calls, no internet dependency, and no data leaving your infrastructure. Clone the repo, open a project, and run.
Browse all samples on GitHub →
Tip
New to LM-Kit.NET? Start with Your First AI Agent to set up your environment and build a working agent in minutes.
1. Get Running in 60 Seconds
git clone https://github.com/LM-Kit/lm-kit-net-samples.git
cd lm-kit-net-samples
Open any .csproj in your IDE and run. Models download automatically on first launch. No API keys. No configuration files. No cloud accounts.
| Platform | GPU Support |
|---|---|
| Windows x64 | CUDA 12/13, Vulkan, CPU |
| Linux x64 / ARM64 | CUDA 12/13, Vulkan, CPU |
| macOS (Apple Silicon) | Metal, CPU |
2. Solve a Real Problem
Find the right sample for your use case:
| I need to... | Start with |
|---|---|
| Have a conversation with a local LLM | Multi-Turn Chat |
| Build an autonomous agent that reasons and acts | Research Assistant |
| Ask questions about my documents | Conversational RAG |
| Chat with a specific PDF | Chat with PDF |
| Give an agent web search, calculators, and file access | Tool Calling Assistant |
| Analyze and navigate a codebase with AI | Code Analysis Assistant |
| Generate and modify code files locally | Code Writing Assistant |
| Extract structured data from unstructured text | Structured Data Extraction |
| Parse resumes (text, PDF, or scanned images) into structured profiles | Resume Parser |
| Extract expense data from receipts (text, PDF, or photos) | Receipt & Expense Scanner |
| Extract key terms from contracts (text, PDF, or scanned images) | Contract Key Terms Extractor |
| Detect and redact PII from documents | PII Extraction |
| Classify documents by category | Document Classification |
| Analyze customer sentiment at scale | Sentiment Analysis |
| Transcribe audio locally | Speech to Text |
| Convert scanned documents to searchable Markdown | Document to Markdown |
| Extract text and coordinates from images with OCR | VLM OCR with Coordinates |
| Search text in a PDF or image and highlight matches | Search and Highlight |
| Build a help desk knowledge base | Help Desk Knowledge Base |
| Translate content between languages | Text Translator |
| Turn meeting recordings into action items | Smart Meeting Assistant |
| Analyze CSV or JSON data locally | Data Analyst Agent |
| Classify and draft responses to emails | Email Triage Agent |
| Monitor agent performance with telemetry | Telemetry & Observability |
3. Industry Solutions
Healthcare & Life Sciences
Patient data cannot leave your network. Local AI keeps PHI on-premises.
| Capability | Sample |
|---|---|
| Redact patient PII before sharing records | PII Extraction, Batch PII Extraction |
| Transcribe clinical dictations locally | Speech to Text |
| Generate meeting notes with action items | Smart Meeting Assistant |
| Extract structured data from lab reports | Structured Data Extraction |
| Classify medical documents by type | Document Classification |
Legal & Compliance
Attorney-client privilege requires that documents stay within your infrastructure.
| Capability | Sample |
|---|---|
| Review contracts and flag compliance issues | Multi-Agent Document Review |
| Extract named entities from legal filings | Named Entity Recognition |
| Search case files with natural language | Conversational RAG |
| Summarize lengthy documents | Document Summarizer |
| Search contracts for specific terms and highlight matches | Search and Highlight |
| Extract key terms and risk flags from contracts | Contract Key Terms Extractor |
Also see the how-to guide: Process Email Archives for Compliance and Legal Discovery
Finance & Accounting
Regulatory requirements demand auditability and data sovereignty.
| Capability | Sample |
|---|---|
| Extract invoice data from PDFs and images | Invoice Data Extraction |
| Scan receipts and extract expense data | Receipt & Expense Scanner |
| Analyze market sentiment from reports | Sentiment Analysis |
| Classify financial documents by type | Batch Document Classification |
| Analyze financial data locally with AI | Data Analyst Agent |
| Detect emotions in customer communications | Emotion Detection |
Manufacturing & Field Operations
Field devices and factory floors often have no internet access.
| Capability | Sample |
|---|---|
| Transcribe inspection notes offline | Speech to Text |
| Extract text from equipment manuals (OCR) | VLM OCR |
| Build a searchable knowledge base for procedures | Help Desk Knowledge Base |
| Detect language in multilingual documents | Language Detection |
Also see the how-to guide: Build and Deploy an Offline AI Application for Edge Environments
Customer Service
Respond faster with AI that understands your product documentation.
| Capability | Sample |
|---|---|
| Build a support chatbot grounded in your docs | Conversational RAG |
| Route tickets to the right team | Custom Classification |
| Detect sarcasm and escalation cues | Sarcasm Detection |
| Triage and draft email responses | Email Triage Agent |
| Extract structured info from web content | Web Content Extractor to JSON |
4. Architecture Patterns
Each sample demonstrates a proven pattern you can adapt to your application:
Single Agent
One model, one task. The agent reasons, calls tools, and returns a result.
→ Research Assistant · Tool Calling Assistant · Web Search Assistant
Multi-Agent Pipeline
Multiple agents execute in sequence, each transforming the output for the next stage.
→ Content Creation Pipeline · Multi-Agent Document Review · Smart Meeting Assistant
Supervisor Delegation
A supervisor agent routes tasks to specialized worker agents based on the request.
→ Smart Task Router · Email Triage Agent
RAG (Retrieval-Augmented Generation)
Embed documents into vectors, retrieve relevant chunks, and generate grounded answers.
→ Conversational RAG · Single-Turn RAG · Help Desk Knowledge Base · Qdrant Integration · pgvector Integration
Document Processing Pipeline
Ingest documents, extract text and structure, convert formats, and index for search.
→ Document to Markdown · VLM OCR · Search and Highlight · Document Splitting · Document Processing Agent
Code Analysis & Generation
Equip a conversation with file system and web search tools to read, analyze, and write code through natural language.
→ Code Analysis Assistant · Code Writing Assistant
External Tool Servers (MCP)
Connect agents to external tool servers via the Model Context Protocol.
→ MCP Integration · MCP Stdio Integration
5. Learning Paths
Beginner: Your First Week
Build confidence with core capabilities.
- Single-Turn Chat: send one prompt, get one response.
- Multi-Turn Chat: hold a conversation with history.
- Sentiment Analysis: classify text by sentiment.
- Text Translator: translate between languages.
- Speech to Text: transcribe audio locally.
Intermediate: Production Capabilities
Combine multiple features into real applications.
- Tool Calling Assistant: give the model tools to call.
- Code Analysis Assistant: read files and explore codebases with built-in tools.
- Conversational RAG: ground answers in your documents.
- PII Extraction: detect and redact sensitive data.
- Document to Markdown: convert any document to searchable text.
- Persistent Memory Assistant: remember facts across sessions.
Advanced: Enterprise Patterns
Build multi-agent systems with orchestration, delegation, and observability.
- Research Assistant: ReAct planning with web search and tool use.
- Code Writing Assistant: read, create, and modify source files with built-in tools.
- Smart Task Router: supervisor-based delegation across specialist agents.
- Content Creation Pipeline: sequential multi-agent workflows.
- Filter Pipeline: add middleware guardrails to agent conversations.
- Telemetry & Observability: instrument agents with OpenTelemetry.
6. All Samples at a Glance
The catalogue below mirrors the LM-Kit.NET capability pillars and matches the on-disk layout under console_net/<pillar>/<category>/<sample>/. Pillar order follows the website navigation.
AI Agents
Chatbots
| Sample | What It Demonstrates |
|---|---|
| Persona-Driven Chatbot | AgentTemplates.Chat(model).WithPersonality(...) minimal loop |
Agent Templates
| Sample | What It Demonstrates |
|---|---|
| Agent Templates Catalogue | Chat / Writer / Analyst / ReAct templates on the same prompt |
Permissions
| Sample | What It Demonstrates |
|---|---|
| Tool Permission Policies | Safe-chat vs developer profile via ToolPermissionPolicy |
Streaming
| Sample | What It Demonstrates |
|---|---|
| Streaming Agent Responses | StreamingAgentExecutor + IAsyncEnumerable<AgentStreamToken> |
Resilience
| Sample | What It Demonstrates |
|---|---|
| Resilience Policies | Retry, circuit breaker, fallback, composite policies |
Agent Memory
| Sample | What It Demonstrates |
|---|---|
| Multi-Turn Chat with Memory | Agent memory with semantic recall |
| Persistent Memory Assistant | Long-term knowledge across sessions |
Agent Reasoning
| Sample | What It Demonstrates |
|---|---|
| Research Assistant | ReAct planning with web search |
Agent Skills
| Sample | What It Demonstrates |
|---|---|
| Skill-Based Assistant | Load agent skills from SKILL.md files |
Delegation
| Sample | What It Demonstrates |
|---|---|
| Email Triage Agent | Email classification and response drafting |
| Smart Task Router | Supervisor-based task delegation |
Filter Pipeline
| Sample | What It Demonstrates |
|---|---|
| Filter Pipeline | Middleware guardrails for agent conversations |
Graph Orchestration
| Sample | What It Demonstrates |
|---|---|
| Graph Orchestration Showcase | Six-agent draft / review / revise pipeline using composable graph nodes |
MCP
| Sample | What It Demonstrates |
|---|---|
| MCP Integration | Connect to external MCP tool servers |
| MCP Stdio Integration | Stdio-based MCP server connectivity |
Multi-Agent Workflows
| Sample | What It Demonstrates |
|---|---|
| Content Creation Pipeline | Sequential multi-agent workflow |
| Multi-Agent Document Review | Parallel multi-perspective document analysis |
| Smart Meeting Assistant | Transcription to meeting notes pipeline |
Observability
| Sample | What It Demonstrates |
|---|---|
| Agent Telemetry with ActivitySource | OpenTelemetry-compatible distributed tracing for agents |
| Telemetry & Observability | OpenTelemetry tracing and metrics |
Single Function Call
| Sample | What It Demonstrates |
|---|---|
| Function Calling | Register and invoke custom functions |
Tools & Function Calling
| Sample | What It Demonstrates |
|---|---|
| Code Analysis Assistant | Code analysis with built-in file system and web search tools |
| Code Writing Assistant | Code generation and file modification with built-in read/write tools |
| Data Analyst Agent | Local data analysis with built-in tools |
| Document Processing Agent | Agent-driven PDF and image processing |
| News Monitoring Agent | Automated news tracking with web search |
| Tool Calling Assistant | Custom tool implementation |
| Web Search Assistant | Real-time web search integration |
Document Intelligence
Document RAG
| Sample | What It Demonstrates |
|---|---|
| Document RAG | Index a folder of mixed-format documents, chat with citations |
Chat with PDF
| Sample | What It Demonstrates |
|---|---|
| Chat with PDF | Interactive PDF Q&A |
Layout Understanding
| Sample | What It Demonstrates |
|---|---|
| Layout Understanding | Lines, paragraphs, bounding boxes via VlmOcr + PageElement |
OCR
| Sample | What It Demonstrates |
|---|---|
| OCR | Single-image OCR via VlmOcr.Run |
Image Processing
| Sample | What It Demonstrates |
|---|---|
| Image Preprocessing | Resize, rotate, auto-crop with ImageBuffer |
Document Conversion
| Sample | What It Demonstrates |
|---|---|
| Document Conversion to Markdown | Universal converter for PDF / DOCX / XLSX / EML / HTML |
PDF Toolkit
| Sample | What It Demonstrates |
|---|---|
| PDF Metadata Inspector | Title, author, permissions, page sizes, security handler |
| PDF Merge Batch | PdfMerger.MergeFiles to combine a list of PDFs |
| PDF Splitter by Page Range | PdfSplitter.SplitToFiles with multi-range syntax |
| PDF Pages to Image Thumbnails | PdfRenderer.RenderPagesToFolder for one file per page (PNG / JPEG / WebP / BMP / TIFF / TGA / PNM) |
| PDF to Multi-page TIFF Archive | PdfRenderer.RenderPagesToMultipageTiff packs all pages into one .tif |
| PDF Page Rotator | PdfEditor.ApplyToFile with PageEdit rotations |
| PDF Text Search with Highlights | PdfSearch.FindText returning bounding-box matches |
| Searchable PDF from Scans | PdfSearchableMaker.ConvertToFile (PDF -> PDF/OCR) |
| Multipage TIFF to PDF/A-1B Archive | ImageToSearchablePdf.ConvertAsync + PdfGenerationOptions.Version = PdfA1b (TIFF -> PDF/A-1B) |
| Encrypted PDF Workflows | Inspect, render, search, split, edit password-protected PDFs end to end |
Email Processing
| Sample | What It Demonstrates |
|---|---|
| Email Processing | Convert .eml archives to Markdown for downstream pipelines |
Document Classification
| Sample | What It Demonstrates |
|---|---|
| Batch Document Classification | Classify documents at scale |
| Document Classification | Automatic document type detection |
Document Search
| Sample | What It Demonstrates |
|---|---|
| Search and Highlight | Search text in PDFs/images and highlight matches |
Document Splitting
| Sample | What It Demonstrates |
|---|---|
| Document Splitting | Intelligent document segmentation |
Document Summarization
| Sample | What It Demonstrates |
|---|---|
| Document Summarizer | Automatic document summarization |
Document to Markdown
| Sample | What It Demonstrates |
|---|---|
| Document to Markdown | Universal document-to-Markdown engine (PDF, DOCX, PPTX, XLSX, EML, MBOX, HTML, images) |
Structured Data Extraction
| Sample | What It Demonstrates |
|---|---|
| Contract Key Terms Extractor | Extract clauses, parties, dates, and risk flags from contracts and scanned images using VLMs |
| Invoice Data Extraction | Extract fields from invoices |
| Receipt & Expense Scanner | Extract expense data from receipts and photos using VLMs |
| Resume Parser | Extract candidate profiles from resumes and scanned images using VLMs |
Vision & Multimodal
Image Understanding
| Sample | What It Demonstrates |
|---|---|
| Image Understanding | Caption, describe, count, and reason about an image with a VLM |
Image Classification
| Sample | What It Demonstrates |
|---|---|
| Zero-Shot Image Classification | Classify into a fixed list of categories with no training data |
Image Labeling
| Sample | What It Demonstrates |
|---|---|
| Multi-Label Image Tagging | Generate 5-10 short tags per image with a VLM |
Chat with Image
| Sample | What It Demonstrates |
|---|---|
| Multi-Turn Chat with Vision | Image understanding in conversations |
Image Embeddings
| Sample | What It Demonstrates |
|---|---|
| Image Similarity Search | Find visually similar images |
VLM OCR
| Sample | What It Demonstrates |
|---|---|
| VLM OCR | Vision-based OCR |
| VLM OCR with Coordinates | OCR with bounding box positions |
Background Removal
| Sample | What It Demonstrates |
|---|---|
| Background Removal | On-device transparent-background PNG output with the bundled U2-Net |
RAG & Knowledge
Embeddings
| Sample | What It Demonstrates |
|---|---|
| Text Embeddings | Vectorise a query and corpus, rank by cosine similarity |
Query Expansion
| Sample | What It Demonstrates |
|---|---|
| Query Expansion (Multi-Query and HyDE) | Compare Original, MultiQuery, and HypotheticalAnswer retrieval modes |
Reranker
| Sample | What It Demonstrates |
|---|---|
| Reranker | Cross-encoder rerank on top of embedding retrieval |
Data Extraction
| Sample | What It Demonstrates |
|---|---|
| Structured Data Extraction | Schema-driven field extraction |
| Web Content Extractor to JSON | Parse web content into structured JSON |
RAG Chat
| Sample | What It Demonstrates |
|---|---|
| Conversational RAG | Multi-turn retrieval-augmented generation |
| Help Desk Knowledge Base | Build a searchable support system |
| Retrieval Quality Tuning | Optimize retrieval precision and recall |
| Single-Turn RAG | Simple question-answering over documents |
Vector Database
| Sample | What It Demonstrates |
|---|---|
| Single-Turn RAG with Qdrant | External vector database integration |
| Single-Turn RAG with pgvector | PostgreSQL (pgvector) vector database integration |
Text Analysis
Content Classification
| Sample | What It Demonstrates |
|---|---|
| Custom Classification | Define your own categories |
Keyword Extraction
| Sample | What It Demonstrates |
|---|---|
| Keyword Extraction | Pull key terms from documents and images using VLMs |
Language Detection
| Sample | What It Demonstrates |
|---|---|
| Language Detection from Document | Detect language from PDFs, documents, and images using VLMs |
Named Entity Recognition
| Sample | What It Demonstrates |
|---|---|
| Named Entity Recognition | Identify people, places, organizations |
PII Extraction
| Sample | What It Demonstrates |
|---|---|
| Batch PII Extraction | PII detection across many documents |
| PII Extraction | Detect personal information |
Sentiment Analysis
| Sample | What It Demonstrates |
|---|---|
| Emotion Detection | Identify emotions in text |
| Sarcasm Detection | Detect sarcasm and irony |
| Sentiment Analysis | Positive/negative/neutral classification |
Multimodal Embeddings
| Sample | What It Demonstrates |
|---|---|
| Multimodal Embeddings | Embed text and images into one aligned space (Nomic) for cross-modal search |
Speech & Audio
Real-Time Transcription
| Sample | What It Demonstrates |
|---|---|
| Audio Transcription App (MAUI) | Cross-platform transcription desktop app |
| Speech to Text | Local Whisper transcription |
Voice Activity Detection
| Sample | What It Demonstrates |
|---|---|
| Voice Activity Detection | Gate Whisper with Silero VAD: faster, no silence hallucinations |
Audio Language Detection
| Sample | What It Demonstrates |
|---|---|
| Audio Language Detection | Identify spoken language before transcription, then pin it for accuracy |
Also see the how-to guide: Build a Voice-Commanded Agent That Executes Tools
Text Generation
Content Summarization
| Sample | What It Demonstrates |
|---|---|
| Text Summarizer | Summarize plain text |
Conversations
| Sample | What It Demonstrates |
|---|---|
| Chat Playground (MAUI) | Cross-platform desktop chat app |
| Multi-Turn Chat | Basic multi-turn conversation |
| Multi-Turn Chat with Chat History Guidance | History management strategies |
| Multi-Turn Chat with Custom Sampling | Temperature, top-p, and sampler control |
| Multi-Turn Chat with Persistent Session | Save and restore conversation state |
| Single-Turn Chat | Simplest possible interaction |
Grammar & Spell Correction
| Sample | What It Demonstrates |
|---|---|
| Text Corrector | Grammar and spelling correction |
Prompt Templates
| Sample | What It Demonstrates |
|---|---|
| Prompt Templates with Logic | Variables, conditionals, loops, and filters |
Structured Content Creation
| Sample | What It Demonstrates |
|---|---|
| Multi-Turn Chat with Yes/No Assistant | Constrained output formatting |
Text Enhancement
| Sample | What It Demonstrates |
|---|---|
| Text Rewriter | Rewrite in different styles |
Text Translation
| Sample | What It Demonstrates |
|---|---|
| Text Translator | Multilingual translation |
Local Inference
Model Catalog
| Sample | What It Demonstrates |
|---|---|
| Model Catalog Browser | Filter the predefined catalog by capability and load by ModelID |
Hardware Backends
| Sample | What It Demonstrates |
|---|---|
| Hardware Backends Inspector | Detect CPU/CUDA/Vulkan/Metal, enumerate GPUs, report layer placement |
Multi-GPU
| Sample | What It Demonstrates |
|---|---|
| Multi-GPU and Tensor Overrides | Run 30B MoE models across CPU + multi-GPU with regex placement rules |
Context Hibernation
| Sample | What It Demonstrates |
|---|---|
| Context Hibernation | Serialize the KV-cache to disk and rehydrate on next inference call |
Sampling Controls
| Sample | What It Demonstrates |
|---|---|
| Sampling and Generation Controls | Greedy, nucleus, and Mirostat v2 side by side |
Encrypted Models
| Sample | What It Demonstrates |
|---|---|
| Encrypted Model Loading | Load and run encrypted GGUF/LMK models |
Model Optimization
Model Quantization
| Sample | What It Demonstrates |
|---|---|
| Quantization | Reduce model size for edge deployment |
LoRA Integration
| Sample | What It Demonstrates |
|---|---|
| LoRA Adapter Hot-Swap | Apply, list, and remove LoRA adapters on a loaded base model at inference time |
Integrations
Microsoft.Extensions.AI
| Sample | What It Demonstrates |
|---|---|
| Microsoft.Extensions.AI Integration | Use LM-Kit as an IChatClient drop-in |
Semantic Kernel
| Sample | What It Demonstrates |
|---|---|
| Semantic Kernel Integration Memory Demo | LM-Kit as a Semantic Kernel backend |
Also see the how-to guide: Migrate from Cloud AI APIs to Local Inference with Microsoft.Extensions.AI
7. Hardware Quick Reference
All samples run on CPU. GPU acceleration is optional but recommended for larger models.
| Sample Category | Minimum VRAM | Recommended Model |
|---|---|---|
| Chat & Conversation | 6 GB | gemma4:e4b |
| AI Agents (with tools) | 4 GB | qwen3.5:9b |
| Classification & Analysis | 2 GB | qwen3.5:2b |
| Data Extraction (NER, PII) | 2 GB | qwen3.5:2b |
| Document Processing (OCR) | 6 GB | gemma4:e4b + vision model |
| Embeddings & RAG | 2 GB | qwen3-embedding:0.6b + chat model |
| Speech & Audio | < 1 GB | whisper-large-turbo3 |
| Fine-Tuning | 8+ GB | Depends on base model |
| Multi-Agent Orchestration | 4 GB | qwen3.5:9b |
No GPU? Every sample works on CPU. Use smaller models (
qwen3.5:0.8b,qwen3.5:2b,phi4-mini:3.8b) for faster CPU inference. See Choosing the Right Model.
8. Platform & Integration Support
LM-Kit.NET fits into your existing .NET stack:
| Integration | What It Provides | Sample |
|---|---|---|
| Microsoft.Extensions.AI | IChatClient and IEmbeddingGenerator interfaces |
Extensions.AI Integration |
| Semantic Kernel | Use LM-Kit as a Semantic Kernel AI backend | Semantic Kernel Memory Demo |
| Model Context Protocol (MCP) | Connect to external tool servers | MCP Integration |
| Qdrant | External vector database for production RAG | Single-Turn RAG with Qdrant |
| PostgreSQL (pgvector) | External vector database for production RAG | Single-Turn RAG with pgvector |
| OpenTelemetry | Distributed tracing and metrics | Telemetry & Observability |
| .NET MAUI | Cross-platform desktop and mobile apps | Chat Playground |
9. Share & Get Involved
Found a sample useful? Use the share buttons below this article (copy link, X, LinkedIn, Reddit) to share it with your team.
⭐ Star the samples repo on GitHub · Report an issue · Contribute a sample