Skip to content

feat: add GenAI building-block samples (DataIngestion, MCP, A2A, MAF image-gen) + fixes#521

Open
elbruno wants to merge 1 commit into
mainfrom
feature/genai-building-blocks-samples
Open

feat: add GenAI building-block samples (DataIngestion, MCP, A2A, MAF image-gen) + fixes#521
elbruno wants to merge 1 commit into
mainfrom
feature/genai-building-blocks-samples

Conversation

@elbruno

@elbruno elbruno commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds several new building-block samples and applies fixes/enhancements to existing samples and lesson docs. All new samples are generic and reusable for the course (no event/session-specific content).

New samples

Sample Lesson What it shows
CoreSamples/DataIngestion-01-Simple 03 Document ingestion pipeline (read → chunk → embed → store) backed by sqlite-vec
CoreSamples/MCP-03-MicrosoftLearn 04 Before/after demo: same question without tools vs. grounded with the Microsoft Learn MCP server
MAF/A2A-01 04 Agent-to-Agent (A2A) protocol: host a MAF agent and call it as a remote agent
MAF/MAF-MCP-01 04 A MAF agent that owns Microsoft Learn MCP tools
MAF/MAF-ImageGen-03-Foundry 04 A MAF agent with an image-generation tool (GPT-Image-2 on Microsoft Foundry)

Fixes & enhancements

  • BasicChat-05AIFoundryModels — Foundry model swap via a single config value + Microsoft Entra ID integrated security (keyless) path, with README.
  • RAGSimple-02MEAIVectorsMemory — switched to a local sqlite-vec store, multi-query search, and streaming output.
  • MAF01 / MAF02 — token-by-token streaming of agent/workflow responses.
  • Lesson 03 & 04 docs — updated sample reference tables and descriptions for the new and changed samples.

Validation

  • dotnet build samples/CoreSamples/CoreGenerativeAITechniques.sln -c Release → Build succeeded, 0 errors.
  • dotnet build samples/MAF/MAF-Demos.slnx -c Release → Build succeeded, 0 errors.

New projects are registered in their respective solutions (CoreGenerativeAITechniques.sln, MAF-Demos.slnx).

…MCP-01, MAF-ImageGen) and fixes

New samples:

- CoreSamples/DataIngestion-01-Simple: document ingestion pipeline with sqlite-vec

- CoreSamples/MCP-03-MicrosoftLearn: before/after grounding with Microsoft Learn MCP

- MAF/A2A-01: Agent-to-Agent protocol host + client

- MAF/MAF-MCP-01: MAF agent owning Learn MCP tools

- MAF/MAF-ImageGen-03-Foundry: MAF agent with GPT-Image-2 image tool

Updates/fixes:

- BasicChat-05AIFoundryModels: Foundry model swap + Entra ID integrated security

- RAGSimple-02MEAIVectorsMemory: sqlite-vec store, multi-query, streaming

- MAF01/MAF02: token-by-token streaming output

- Lesson 03/04 docs: updated sample tables and descriptions
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

👋 Thanks for contributing @elbruno! We will review the pull request and get back to you soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the course’s runnable .NET building-block content by adding new CoreSamples and MAF samples (Data Ingestion, MCP grounding, Agent-to-Agent, MAF-owned MCP tools, and Foundry image generation), while also updating a few existing demos and lesson docs to align with the new sample set.

Changes:

  • Added new samples: DataIngestion-01-Simple, MCP-03-MicrosoftLearn, MAF-MCP-01, A2A-01, and MAF-ImageGen-03-Foundry, and registered them in the relevant solutions.
  • Updated existing MAF demos (MAF01, MAF02) to stream agent/workflow output token-by-token for better live demos.
  • Refreshed Lesson 03/04 documentation tables and descriptions to reference the new/updated samples.
Show a summary per file
File Description
samples/MAF/MAF02/Program.cs Switches workflow output to streaming in console.
samples/MAF/MAF01/Program.cs Switches agent output to streaming in console.
samples/MAF/MAF-MCP-01/README.md Documents a MAF agent that owns Microsoft Learn MCP tools.
samples/MAF/MAF-MCP-01/Program.cs Implements MAF agent wiring to Microsoft Learn MCP tools + streaming output.
samples/MAF/MAF-MCP-01/MAF-MCP-01.csproj Adds new MAF MCP sample project and dependencies.
samples/MAF/MAF-ImageGen-03-Foundry/README.md Documents Foundry GPT-Image-2 tool wrapped for a MAF agent.
samples/MAF/MAF-ImageGen-03-Foundry/Program.cs Implements image-gen tool + MAF agent composition and saving/opening output PNGs.
samples/MAF/MAF-ImageGen-03-Foundry/MAF-ImageGen-03-Foundry.csproj Adds new image-gen sample project and dependencies.
samples/MAF/MAF-Demos.slnx Registers new MAF samples in the MAF demo solution.
samples/MAF/A2A-01/README.md Documents the minimal in-process A2A server+client demo.
samples/MAF/A2A-01/Program.cs Implements hosting a MAF agent over A2A and calling it via A2AClient.
samples/MAF/A2A-01/A2A-01.csproj Adds new A2A sample project and preview dependencies.
samples/CoreSamples/RAGSimple-02MEAIVectorsMemory/README.md Updates docs to reflect sqlite-vec + VectorData abstractions and keyless auth.
samples/CoreSamples/RAGSimple-02MEAIVectorsMemory/RAGSimple-02MEAIVectorsMemory.csproj Moves sample to sqlite-vec connector + Azure.Identity + newer MEAI packages.
samples/CoreSamples/RAGSimple-02MEAIVectorsMemory/Program.cs Reworks RAG sample to VectorData + sqlite-vec and multiple queries.
samples/CoreSamples/MCP-03-MicrosoftLearn/README.md Documents the “before/after grounding” MCP demo using Microsoft Learn MCP server.
samples/CoreSamples/MCP-03-MicrosoftLearn/Program.cs Implements grounded vs ungrounded comparison using MCP tools + function invocation.
samples/CoreSamples/MCP-03-MicrosoftLearn/MCP-03-MicrosoftLearn.csproj Adds the MCP-03 sample project and dependencies.
samples/CoreSamples/DataIngestion-01-Simple/README.md Documents ingestion pipeline stages and how to run the sample.
samples/CoreSamples/DataIngestion-01-Simple/Program.cs Implements ingestion pipeline (read/chunk/enrich/embed/write) + search over sqlite-vec.
samples/CoreSamples/DataIngestion-01-Simple/DataIngestion-01-Simple.csproj Adds the ingestion sample project, packages, and data copy rules.
samples/CoreSamples/DataIngestion-01-Simple/data/dotnet-ai-building-blocks.md Adds ingestion input content describing .NET AI building blocks.
samples/CoreSamples/CoreGenerativeAITechniques.sln Registers new CoreSamples projects (MCP-03, DataIngestion-01).
samples/CoreSamples/BasicChat-05AIFoundryModels/README.md Adds documentation for Foundry model swap + integrated security flow.
samples/CoreSamples/BasicChat-05AIFoundryModels/app.cs Updates Foundry chat demo to support auth mode + one-shot question.
04-AgentsWithMAF/04-model-context-protocol.md Updates Lesson 04 sample table to include MCP-03 and MAF-MCP-01.
04-AgentsWithMAF/03-multi-agent-workflows.md Updates Lesson 04 workflow table to include A2A-01.
04-AgentsWithMAF/02-agents-with-tools.md Updates Lesson 04 tools table to include MAF-ImageGen-03-Foundry.
03-AIPatternsAndApplications/readme.md Updates Lesson 03 sample references (sqlite-vec update).
03-AIPatternsAndApplications/02-retrieval-augmented-generation.md Adds DataIngestion-01-Simple + updates RAGSimple-02 description.
03-AIPatternsAndApplications/01-embeddings-semantic-search.md Updates wording + sample references for sqlite-vec update.

Copilot's findings

  • Files reviewed: 31/31 changed files
  • Comments generated: 3

Comment on lines +20 to +25
// Swap the model by changing ONLY the deployment name.
// In Microsoft Foundry you deploy several models behind the same endpoint, e.g.:
// gpt-5.5 -> grok-4.3 -> phi-4 -> ... (same code, same endpoint, just this string).
//var deploymentName = config["AzureOpenAI:Deployment"] ?? "gpt-5-mini";
var deploymentName = "Kimi-K2.6";

Comment on lines +33 to +56
var chatModel = config["AzureOpenAI:ChatDeployment"] ?? "gpt-5-mini";
var embeddingModel = config["AzureOpenAI:EmbeddingDeployment"] ?? "text-embedding-3-small";

using ILoggerFactory loggerFactory =
LoggerFactory.Create(builder => builder.AddSimpleConsole());

// Create the Azure OpenAI clients (keyless: uses your `az login` credentials).
var azureClient = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential());
IChatClient chatClient = azureClient.GetChatClient(chatModel).AsIChatClient();
IEmbeddingGenerator<string, Embedding<float>> embeddingGenerator =
azureClient.GetEmbeddingClient(embeddingModel).AsIEmbeddingGenerator();

// --- READ ------------------------------------------------------------------
// Read Markdown documents into a unified, LLM-friendly representation.
IngestionDocumentReader reader = new MarkdownReader();

// --- CHUNK -----------------------------------------------------------------
// Split documents into semantic chunks so related content stays together.
IngestionChunkerOptions chunkerOptions = new(TiktokenTokenizer.CreateForModel(chatModel))
{
MaxTokensPerChunk = 2000,
OverlapTokens = 0
};
IngestionChunker<string> chunker = new SemanticSimilarityChunker(embeddingGenerator, chunkerOptions);
Comment on lines +36 to +38
After ingestion, type a question and the app returns the most relevant chunks with
their similarity scores. The vector data is persisted to a local `buildingblocks-vectors.db`
sqlite-vec file next to the app binary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants