Moving forward, We'll maintain one single application named AiLearningApi throughout our AI learning journey.
You can download the application from here as well, but I recommend you to do it by yourself.
Github link : https://github.com/goelvinay5/AiLearningApi
Setting Value
Project name AiLearningApi
Framework .NET 10
Target framework net10.0
Application type ASP.NET Core Web API
Language C# 14
AI abstraction Microsoft.Extensions.AI
Initial AI provider Groq
Create the project:
dotnet new webapi --use-controllers -n AiLearningApi -f net10.0
Rather than creating a new project for every lesson, we'll organize labs by feature.
AiLearningApi
│
├── Controllers
│ ├── ChatController.cs
│ ├── StreamingController.cs
│ ├── EmbeddingController.cs
│ └── AgentController.cs
│
├── Services
│ ├── ChatService.cs
│ ├── StreamingService.cs
│ ├── EmbeddingService.cs
│ └── AgentService.cs
│
├── Models
│ ├── Chat
│ ├── Embeddings
│ ├── Documents
│ └── Agents
│
├── Configuration
│
├── Data
│
├── appsettings.json
└── Program.cs
This is our illustrative structure. We'll add folders and classes only when the corresponding lab requires them.
Now implement the code from last exercise in this application and after proceed with following steps
install:
dotnet add package Swashbuckle.AspNetCore
This provides Swagger/OpenAPI UI through Swashbuckle.
Add the following in Program.cs:
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
And before app.MapControllers():
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
Learning phase What we'll add
.NET AI fundamentals Chat API and IChatClient
Streaming Streaming chat endpoint
Function calling C# tools callable by AI
Structured outputs JSON-based AI responses
Conversation memory Persistent conversation storage
Embeddings Embedding generation API
RAG Document ingestion and retrieval
AI agents Agent workflows and orchestration
We'll also keep earlier labs working as we add new functionality.