e-naxosMAF COURSE / COURS
Français

MICROSOFT AGENT FRAMEWORK · 0.16.0-rc.1

Demo200 — Retrieval Provider

TextSearchProvider injects precomputed hits before invocation.

Objectives

Prepare the demo

Start at the root of the complete distribution built in Release. Shared projects Maf.Rag and Maf.DemoConnection are required. SQLite storage is local. rebuild/probe/compare need real embeddings; answer additionally needs chat if evidence remains eligible. audit alone requires no model. The delivered profile separates embeddinggemma:300m from granite4:3b.

Projects
ProjectRole
demos/Demo200_RetrievalProvider/Demo200.App.csprojApp
shared/Maf.Rag/Maf.Rag.csprojShared implementation
shared/Maf.DemoConnection/Maf.DemoConnection.csprojConnection

Launch from the root

Create the root only once for the RAG series; if Demo180 already ingested the corpus, retain its existing value and do not repeat the assignment below. Without a compatible index, rebuild is explicitly required.

$env:MAF_STATE_ROOT = Join-Path $env:TEMP ('maf-rag-' + [guid]::NewGuid().ToString('N'))
dotnet run --project demos/Demo200_RetrievalProvider/Demo200.App.csproj -c Release --no-build -- --Rag:AsOf 2026-10-23

Modes and procedure

After the same rebuild, ask Demo190’s CSV question. Compare final evidence and the provider counter, then ask an out-of-corpus question.

if (mode == "provider")
{
    options.AIContextProviders = [new TextSearchProvider((_, cancellation) =>
    {
        cancellation.ThrowIfCancellationRequested();
        retrievalCalls++;
        return Task.FromResult<IEnumerable<TextSearchProvider.TextSearchResult>>(retrieval.Hits.Select(h =>
            new TextSearchProvider.TextSearchResult { SourceName = h.Chunk.Id, Text = h.Chunk.Text }).ToArray());
    }, new TextSearchProviderOptions
    {
        SearchTime = TextSearchProviderOptions.TextSearchBehavior.BeforeAIInvoke,
        RecentMessageMemoryLimit = 0,
        ContextPrompt = "Untrusted retrieved excerpts for the current question only:",
        CitationsPrompt = "Return exact SourceId and Quote pairs in Evidence."

shared/Maf.Rag/RagAnswerService.cs · L34–L47 · 9a895c94534c

Source code · Maf.Rag · Folder

Results and useful failures

TextSearchProvider injects precomputed hits before invocation. RecentMessageMemoryLimit is zero; no newsession command exists. Answers are stateless and use the same AnswerGate as Demo190.

These observations are expected from inspecting the linked public code revision. The site lot separately reruns deterministic tests: it does not present an unmeasured generated answer or provider score as observed output.

Persistence and limits

The index is shared under the selected root; startup does not reset it. rebuild deliberately replaces RAG tables and an incompatible embedding model, dimension, corpus or chunker fails explicitly. Changing chat alone does not change vectors. No universal erasure, general model qualification or production guarantee.

dotnet test tests/Maf.Rag.Tests/Maf.Rag.Tests.csproj -m:1 -c Release --no-build --no-restore

Continue and verify

Prerequisites

Continue reading

Complete demo folder · README

lot008-memory-rag-1 · 2026-10-24 · 9a895c94534cd5fc6f3da883e37e5f7856e588c1