Add Microsoft Agent Framework (Microsoft.Agents.AI) with RAG Example - #1423
Add Microsoft Agent Framework (Microsoft.Agents.AI) with RAG Example#1423zsogitbe wants to merge 2 commits into
Conversation
|
Very cool, thanks for adding this! There's a merge conflict, but other than that it looks good to go 馃憤 |
There was a problem hiding this comment.
Pull request overview
This PR adds a new LLama.Examples console example demonstrating LLamaSharp integration with Microsoft鈥檚 Agent Framework / Microsoft.Extensions.AI abstractions, including an in-memory SQLite vector store flow to showcase a deterministic RAG pattern.
Changes:
- Added a new
MicrosoftAgentFrameworkExampleshowing embedding + vector search + constrained agent response generation. - Extended
UserSettingsto support prompting/saving a separate embedding-model path. - Registered the new example in the interactive menu and added new package references to the examples project.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| LLama.Examples/UserSettings.cs | Adds persisted prompt support for an embedding model path. |
| LLama.Examples/LLama.Examples.csproj | Adds new package dependencies for Agent Framework / AI abstractions / SQLite vector store. |
| LLama.Examples/Examples/MicrosoftAgentFrameworkExample.cs | New end-to-end deterministic RAG + agent example using LLamaSharp + Microsoft abstractions. |
| LLama.Examples/ExampleRunner.cs | Registers the new example in the console selection menu. |
馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| { "LLama Model: Get embeddings", GetEmbeddings.Run }, | ||
| { "LLama Model: Quantize", QuantizeModel.Run }, | ||
| { "Grammar: Constrain response to json format", GrammarJsonResponse.Run }, | ||
| { "Microsoft Agent Framework Example", MicrosoftAgentFrameworkExample.Run}, |
Thanks Martin! I think that this merge conflict has something to do with your PR. Can you resolve it, or do I need to do something? |
Overview
This PR introduces a new example to
LLama.Examplesdemonstrating how to integrate LLamaSharp with the Microsoft Agent Framework (Microsoft.Agents.AI), Microsoft's AI abstractions (Microsoft.Extensions.AI), and vector data storage (Microsoft.Extensions.VectorData). Since we are removing Semantic Kernel, we need an agentic example.Motivation & Context
With Microsoft's release of the unified
Microsoft.Extensions.AIabstractions and theMicrosoft.Agents.AIframework, many .NET developers are looking for concrete reference implementations to run fully local, offline agents using open-weights GGUF models.This example bridges that gap by demonstrating:
StatelessExecutorinto Microsoft'sIChatClientusingAsChatClient().LLamaEmbedder.Key Highlights
Data Source=:memory:) viaCommunityToolkit.VectorData.SqliteVec, ensuring no temporary database files clutter the user's disk upon exit.ChatClientAgentRunOptionswith zero temperature (0.0f) to lock agent responses strictly to math-verified retrieved facts.Changes Included
LLama.Examples/Examples/MicrosoftAgentFrameworkExample.cscontaining the end-to-end RAG and Agent workflow.LLama.Examples.csproj(Microsoft.Agents.AI,Microsoft.Extensions.AI, andCommunityToolkit.VectorData.SqliteVec).How Has This Been Tested?
OS: Windows 11
Models Tested:
Chat:
Llama-3.2-3B-Instruct-Q4_K_M.ggufEmbedding:
Qwen3-Embedding-0.6B-Q8_0.gguf(1024 dimensions)Verification: Verified that vector similarity search executes in-memory and the agent generates factual summaries based exclusively on the seeded dummy records without hallucinating outside context.
Checklist
:memory:database used).