Why use Aspire for building LLM-based applications?
Building LLM-based applications, and especially RAG applications, involves many moving parts. First and foremost, you have to deal with a language model hosted in the cloud. Next, you must record history and store documents in a vector database. Finally, you need to combine the frontend and APIs into a working application.
Combining all these components is a lot of work. But there’s a solution: .NET Aspire. A new framework from Microsoft that helps developers build distributed applications.
Aspire has a couple of components to it that matter for building LLM-based applications:
-
The application host serves as an orchestrator, putting all the moving parts together so you can run the infrastructure, API, and frontend by starting an application host project.
-
The Aspire dashboard exposes metrics, logging, and tracing in a single website for all the components in the solution. It makes it a lot easier to debug interactions in your LLM-based application. Also, it helps you discover other important information like the URL for the frontend, etc.
-
The service defaults provide applicable base settings necessary to collect the diagnostics for the dashboard and other general-purpose code for the distributed application.
While Aspire mainly focuses on orchestrating distributed applications, you can generate deployment scripts using the application model you create in the application host. For example, you can easily use the Azure Developer CLI to deploy an Aspire-based application to Azure.
For the purpose of this workshop, we ensured that the application host and service defaults are preconfigured for you. We highly recommend copying the code from the starter folder in each lab to ensure the right configuration.
If you feel up to it, you can configure the application host yourself by following these two tutorials: