Welcome! This workshop aims to help you get started adding AI features to .NET applications.
Why would you want to? Many, perhaps most, nontrivial applications can be made more powerful and productive through adding AI-based features. It can automate many business processes and let users complete their tasks faster while remaining in control.
These features include classification, summarization, data extraction/cleaning, anomaly detection, translation, sentiment detection, semantic search, Q&A chatbots, voice assistants, and more.
This is relevant to developers getting started with AI in .NET applications.
We will assume you're already familiar with .NET and C#, including typical app patterns such as dependency injection (DI). You don't need to know Blazor or web programming, though a couple of the examples will use them. In most cases, examples will be plain console apps to preserve the focus on AI topics.
You don't need prior knowledge of AI technology. We'll focus on the usage of AI services, including LLMs and embeddings, to implement app features such as those listed above. This includes understanding capabilities, limitations, problems, and risks. We'll focus a lot on optimizing for reliability.
We won't be creating or training new AI models from scratch, so it doesn't matter whether you know how things like tokenizers or transformers work.
You'll need:
- A development environment, including:
- .NET 9
- A code editor (e.g., VS 2022, VS Code with the C# Dev Kit extension, or Rider)
- Docker
- Ollama
As for AI services, you can use any of the following:
Service | Notes |
---|---|
OpenAI platform | Ideal. Instructions provided. |
Azure OpenAI | Ideal. Instructions provided. |
Ollama (local) | Instructions provided, but some things are trickier to make work well, and it's nowhere near as fast |
Others (Google Gemini, Anthropic, HuggingFace, etc) | Instructions are not provided but the code should work with slight adaptations, since we use Microsoft.Extensions.AI.Abstractions which supports arbitrary backends. |
Chapter 1 contains more information about how to set these up.
Jump in wherever you like. If you're new to this, starting at chapter 1 makes sense.
Index | Title | Contents | Topics |
---|---|---|---|
1 | Build a Quiz App | Get started quickly with a casual exercise. This helps build familiarity with using LLMs without needing too much theory. | Chat completion. Prompt engineering. Prompt injection. |
2 | Embeddings | Learn how to compute the semantic similarity of text and perform semantic search. This is a basic building block for many AI features. | Embeddings. Semantic search. |
3 | Vector Search | Build an index of embeddings for high-performance semantic search. | Vector databases. FAISS. |
4 | Language Models | Use LLMs to implement a range of application features. | Completion. Streaming. Structured output. Function calling. Chatbots. Middleware. |
5 | Retrieval Augmented Generation | Implement an end-to-end Q&A chatbot, from data ingestion to quality evaluation. | Ingestion. Chunking. Embedding. Retrieval. Citations. Evaluation. RAG triad. |
6 | Vision | Combine multi-modal models with earlier topics to build an image monitoring system. | Multi-modality. Structured output. Small models. Caching. |
7 | Realtime | Produce responses in realtime using an audio-to-audio model, creating a voice assistant. | Realtime APIs |