This sample demonstrates Retrieval-Augmented Generation (RAG) using Microsoft.Extensions.AI with Azure OpenAI and an in-memory vector store.
- .NET 10.0 SDK
- Azure OpenAI / Microsoft Foundry endpoint and API key
Set your Azure OpenAI credentials using user secrets:
cd samples/CoreSamples/RAGSimple-02MEAIVectorsMemory
dotnet user-secrets set "endpoint" "https://<your-endpoint>.services.ai.azure.com/"
dotnet user-secrets set "apikey" "<your-api-key>"
dotnet user-secrets set "embeddingModelName" "text-embedding-3-small"dotnet run- Creates an in-memory vector store
- Loads a collection of movies with descriptions
- Generates embeddings for each movie using Azure OpenAI's text-embedding-3-small model
- Performs a vector search based on a query
- Returns the most relevant movies
The sample uses:
- Microsoft.Extensions.AI for embeddings generation
- Azure.AI.OpenAI for connecting to Azure OpenAI / Microsoft Foundry
- Microsoft.Extensions.VectorData for in-memory vector storage
See the other RAG samples (RAGSimple-03, RAGSimple-04) for Azure AI Search and Qdrant vector store examples.