We’re thrilled to announce that Preview 2 of the .NET AI Chat Web App template is now available! This update brings exciting new features, including support for .NET Aspire and integration with the Qdrant vector database when using .NET Aspire, making it even easier to create cloud-native AI-powered chat applications. Our .NET AI template continues to be part of our ongoing effort to simplify AI development with .NET by providing scaffolding and guidance within Visual Studio, Visual Studio Code, and the .NET CLI.
Install the Updated Template
To get started with Preview 2, you’ll need to install Microsoft.Extensions.AI.Templates from your Terminal. Simply run:
dotnet new install Microsoft.Extensions.AI.Templates
Once installed, the template is available in Visual Studio and Visual Studio Code (with the C# Dev Kit), or you can create it directly in your working directory by running:
dotnet new aichatweb
In a future release we plan to include this template as part of the .NET SDK.
Getting Started with the .NET AI Chat Template
The .NET AI Chat template is designed to help you quickly build an AI-powered chat application that can interact with custom data. This release continues to use the Retrieval Augmented Generation (RAG) pattern, commonly employed for chat applications, and introduces new options for .NET Aspire developers.
What’s New in Preview 2
-
.NET Aspire Support: Expand your development toolkit with .NET Aspire, enabling advanced AI capabilities and robust integration options.
-
Qdrant Vector Database: Preview 2 includes an example of using the Qdrant vector database, further enhancing your ability to prototype and scale applications with vector data.
-
Support for configuration options in VS Code: Now when using the template to create a new project with the C# Dev Kit extension, you can choose to configure additional options and select your model service provider as well as vector store.
Key Features and Configuration Options
-
Chat with Custom Data: Create chat-based UI interactions with sample PDFs or your own data using the RAG pattern.
-
Local and Azure Integration: Choose between a local vector store for quick prototyping or Azure AI Search for more advanced scenarios.
-
Customizable Code: Easily adapt generated code to suit your project needs, including chat interactions, citation tracking, and follow-up suggestions.
-
Data Ingestion: Handle diverse data sources and formats with built-in code for ingestion, caching, and processing.
Use the Template in Visual Studio
After installing the template from the command line, you can find it in Visual Studio under File > New Project… Search for “AI Chat” or choose the AI project type to locate the template.
Name your project, select its location, and configure your setup by selecting an AI model provider and vector store (now including an option to use the Qdrant vector store).
You can learn about each of the options from the .NET AI Templates documentation.
Use Visual Studio Code and the C# Dev Kit
To use the template in Visual Studio Code, first install the C# Dev Kit extension. Then, use the .NET: New Project… command and select the AI Chat Web App template. This will create a new project using GitHub Models and a local vector store by default, with other options detailed in the .NET AI Templates documentation.
Add .NET Aspire Orchestration
The latest update to .NET AI templates introduces .NET Aspire Orchestration, enabling powerful, flexible integrations for both local and cloud-based AI models. By selecting “Use .NET Aspire Orchestration” the template will create a new .NET Aspire solution including a .AppHost project that configures integrations for working with the various AI service & vector store providers.
You can use Ollama for hosting local models via the docker.io/ollama/ollama container image, accessed through the OllamaSharp (enabled by the .NET Aspire Community Toolkit Ollama integration). This functionality offers a seamless way to deploy containerized AI models locally.
The update also includes support for GitHub Models, OpenAI, and Azure OpenAI using the .NET Aspire Azure OpenAI integration, allowing easy connections to advanced language models via Azure’s secure environment or OpenAI APIs. Additionally, developers can utilize enhanced semantic search features with support for Azure AI Search and Qdrant vector stores, empowering efficient indexing and querying of vectorized data for enterprise and open-source solutions alike.
Getting started is straightforward: use the updated template commands to create projects with .NET Aspire-enabled configurations. Whether leveraging local Ollama models, OpenAI services, or robust vector store options, these tools provide a comprehensive framework for cutting-edge AI development.
What’s Coming Next – Share Your Feedback
We’re continuously working to improve the .NET AI template based on your feedback. Future releases will include Console and Minimal API templates, expanded support for Azure AI Foundry, and deeper integration with the Semantic Kernel team. We plan to include the template by default in the .NET SDK, and your input will help us shape the best experience for .NET developers.
Let us know what works well for you and what you’d like to see improved. Thank you for trying out Preview 2 of the .NET AI templates, and happy coding!
in order to have a persistent sqlite database for pdf files metadata and in order to prevent digesting all the pdf files from the beginning (also there will be no extra embedding fees for using the embedding model) each time you start the project, you should add this line
builder.Services.AddDbContext(options =>
options.UseSqlite(“Data Source=ingestioncache.db”));
instead of
builder.AddSqliteDbContext(“ingestionCache”);
in program.cs file of the chatApp.web project