AI chatbots in .NET: New .NET AI template to reduce barriers to entry

To simplify the creation of chatbots with AI functions, a new template is available for Visual Studio, Visual Studio Code and .NET CLI.

listen Print view
Communication between LLM and humans

(Image: Shutterstock/Poca Wander Stock)

3 min. read

Microsoft has released the .NET AI template as a preview. This is a template for creating chatbots based on artificial intelligence. It is available for several Microsoft products: the Visual Studio development environment, the free source code editor Visual Studio Code and the .NET Command-Line Interface (CLI). The C# Dev Kit extension is required for use in Visual Studio Code.

Videos by heise

The .NET AI template is designed to make it easier for developers to get started and quickly create an AI-driven chat application. Chat is possible on the basis of user-defined data that is fed from PDF files. In the initial release, the focus is on a Blazor-based web application using the Microsoft.Extensions.AI and Microsoft.Extensions.VectorData abstractions. Both libraries are currently in preview status. The template also uses the RAG (Retrieval Augmented Generation) pattern, which is often used for chat applications.

The new template supports both local and Azure integrations: It can handle a local vector store for prototyping as well as Azure AI Search. Azure AI Search (formerly Azure Cognitive Search) is an information retrieval system that can be used in traditional and GenAI scenarios.

The code generated by the .NET AI template contains UI components for chat interactions, citation tracking and subsequent suggestions. These components are customizable. The template also provides code for data processing, caching and ingestion.

The template comes with two sample PDF files and an example of data ingestion code to process the PDFs. This code is flexible so that the PDFs can be exchanged. To do this, it is necessary to stop the current project, remove the sample PDFs from the /wwwroot/Data folder and insert your own PDFs there. Then restart the application.

When the application is started, the data ingestion code, which is located in /Services/Ingestion/DataIngestor.cs, synchronizes the contents of the data folder, removes the old files from the configured vector store and adds the new ones.

There are several AI model providers to choose from, here is a screenshot of the development team from Visual Studio:

VIsual Studio: These AI models are available for the .NET AI template.

(Image: Microsoft)

It should be noted that, depending on the number and size of files, the quota and rate limits of the configured AI provider may be reached. This may result in error messages or significant delays when starting the applications.

Further information on using the new AI template can be found on the .NET blog. Additional help for creating AI applications in .NET can be found on the Microsoft Learn page.

(mai)

Don't miss any news – follow us on Facebook, LinkedIn or Mastodon.

This article was originally published in German. It was translated with technical assistance and editorially reviewed before publication.