Skip to content

Commit b3bc054

Browse files
authored
Merge pull request #184 from flcdrg/fixes
Corrections for instructions
2 parents 5f38c7b + bdaf689 commit b3bc054

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

03-CoreGenerativeAITechniques/02-retrieval-augmented-generation.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ You may have heard of vector databases. These are databases that store data in a
3636
We'll use the Microsoft.Extension.AI along with the [Microsoft.Extensions.VectorData](https://www.nuget.org/packages/Microsoft.Extensions.VectorData.Abstractions/) and [Microsoft.SemanticKernel.Connectors.InMemory](https://www.nuget.org/packages/Microsoft.SemanticKernel.Connectors.InMemory) libraries to implement RAG below.
3737

3838
> 🧑‍💻**Sample code:** You can follow along with the [sample code here](./src/RAGSimple-02MEAIVectorsMemory/).
39-
>
39+
>
4040
> You can also see how to implement a RAG app [using Semantic Kernel by itself in our sample source code here](./src/RAGSimple-01SK/).
4141
>
4242
> We have additional RAG examples for different vector stores and models:
43+
>
4344
> - [RAGSimple-03MEAIVectorsAISearch](./src/RAGSimple-03MEAIVectorsAISearch/) - Using Azure AI Search as a vector store
4445
> - [RAGSimple-04MEAIVectorsQdrant](./src/RAGSimple-04MEAIVectorsQdrant/) - Using Qdrant as a vector store
4546
> - [RAGSimple-10SKOllama](./src/RAGSimple-10SKOllama/) - Using Semantic Kernel with Ollama
@@ -75,7 +76,7 @@ We'll use the Microsoft.Extension.AI along with the [Microsoft.Extensions.Vector
7576

7677
// get movie list
7778
var movies = vectorStore.GetCollection<int, MovieVector<int>>("movies");
78-
await movies.CreateCollectionIfNotExistsAsync();
79+
await movies.EnsureCollectionExistsAsync();
7980
var movieData = MovieFactory<int>.GetMovieVectorList();
8081

8182
```
@@ -107,14 +108,9 @@ We'll use the Microsoft.Extension.AI along with the [Microsoft.Extensions.Vector
107108
// generate the embedding vector for the user's prompt
108109
var query = "A family friendly movie that includes ogres and dragons";
109110
var queryEmbedding = await generator.GenerateVectorAsync(query);
110-
var searchOptions = new VectorSearchOptions()
111-
{
112-
Top = 2,
113-
VectorPropertyName = "Vector"
114-
};
115111

116112
// search the knowledge store based on the user's prompt
117-
var results = await movies.VectorizedSearchAsync(queryEmbedding, searchOptions);
113+
var results = movies.SearchAsync(queryEmbedding, 2, new VectorSearchOptions<MovieVector<int>>());
118114

119115
// let's see the results just so we know what they look like
120116
await foreach (var result in results.Results)
@@ -136,7 +132,7 @@ So we could do something like the following while looping through the results of
136132

137133
```csharp
138134

139-
// assuming chatClient is instatiated as before to a language model
135+
// assuming chatClient is instantiated as before to a language model
140136
// assuming the vector search is done as above
141137
// assuming List<ChatMessage> conversation object is already instantiated and has a system prompt
142138
@@ -157,7 +153,7 @@ var response = await chatClient.GetResponseAsync(conversation);
157153
conversation.Add(new ChatMessage(ChatRole.Assistant, response.Message));
158154

159155
//display the conversation
160-
Console.WriteLine($"Bot:> {response.Message.Text});
156+
Console.WriteLine($"Bot:> {response.Message.Text}");
161157
```
162158

163159
> 🙋 **Need help?**: If you encounter any issues, [open an issue in the repository](https://github.com/microsoft/Generative-AI-for-beginners-dotnet/issues/new).

0 commit comments

Comments
 (0)