feat: externalize AI configuration, implement resilience policies, and update extraction prompt formatting

This commit is contained in:
2026-04-26 10:01:47 +02:00
parent d8e6931289
commit 412320980f
6 changed files with 65 additions and 38 deletions
+7 -7
View File
@@ -1,6 +1,6 @@
# 🤖 LLM Agent Implementation Backlog: AI Semantic Integration
**Project Context:** .NET 10, EF Core (SQLite), `Microsoft.Extensions.AI`.
**Project Context:** .NET 10, EF Core (SQLite), `Microsoft.Extensions.AI`, [`GeminiDotnet`](https://github.com/rabuckley/GeminiDotnet).
**Core Goal:** Integrate Gemini 1.5 Flash with a persistent Semantic Cache to minimize API costs and latency.
---
@@ -31,22 +31,22 @@
---
## 🧠 Phase 2: AI Client & Contract Definition
**Objective:** Set up the communication bridge with Google Gemini API.
**Objective:** Set up the communication bridge with Google Gemini API using [`GeminiDotnet`](https://github.com/rabuckley/GeminiDotnet).
### Task 2.1: Define Data Transfer Objects (DTOs)
* **Target Folder:** `Core/DTOs/AI`.
* **Target Folder:** `NexusReader.Application/DTOs/AI`.
* **Requirements:**
* Define `KnowledgePacket` record containing `List<KeyConcept>` and `List<QuizQuestion>`.
* Use `[JsonPropertyName]` attributes for strict JSON mapping.
* **LLM Instructions:** "Define immutable records for the AI response schema. Ensure they match the expected JSON structure from the system prompt."
### Task 2.2: Infrastructure AI Client Setup
* **Target:** `Program.cs` / Dependency Injection.
* **Target:** `NexusReader.Infrastructure/DependencyInjection.cs`.
* **Requirements:**
* Install `Microsoft.Extensions.AI` and `Microsoft.Extensions.AI.Google`.
* Register `IChatClient` using `GoogleChatClient`.
* Install `Microsoft.Extensions.AI` and `GeminiDotnet.Extensions.AI`.
* Register `IChatClient` using `GeminiChatClient`.
* Inject `ApiKey` from `IConfiguration`.
* **LLM Instructions:** "Register the GoogleChatClient in the DI container. Use the .NET 10 `AddChatClient` extension pattern."
* **LLM Instructions:** "Register the `GeminiChatClient` in the DI container. Use the .NET 10 `AddChatClient` extension pattern."
---