The idea of this repo is to quickly demonstrate two basics things:
- How to get started with Semantic Kernel.
- How to implement and end-to-end RAG pattern using Semantic Kernel and Azure AI Search.
Cover the basic of Semantic Kernel based on this. More specifically:
- Prompts Basics
- Plugins Basics
- Text chunking using Semantic Kernel.
- Implementing RAG Pattern (end-to-end) using Azure AI Search, but not using the out-of-the-box SK integration.
Prerequisites:
- Azure OpenAI instance.
- Azure AI Search instance.
- Uncomment [
await SKPromptBasics.Run();
] on programs.cs and explore the code. - Uncomment [
await SKPromptTemplating.Run();
] on programs.cs and explore the code as well.
Play with your first plug-in, uncomment [await SKFirstPlugin.Run();
] on programs.cs and take the follwing steps:
- Ask the question: What is the answer to the great question? -> You should get 42 (da).
- Then ask the question, what is the answer to the even greater question. -> You should get a vague reply, with not an actual number as a reply.
- Uncomment line 28 on SKFirstPlugin.cs, and ask the same question. -> You should get 24, right?
For doing the RAG pattern implementation we are going to use (some - not all) files of Azure Documentation. The idea is to have the LLM reply questions related to Azure Documentation. So, in this section we will do the following:
- Read as text the md files that are zipped in azure-docs.zip (on the root of the project).
- Chunk those documents using SK's chunking functionality.
- Upload the chunked 'entities' on our Azure AI Search Index.
- Implement the RAG pattern by using an SK Plugin to query those docs.
Steps:
- First, just unzip and store somewhere on your disk the contents of the
azure-docs.zip
. - Uncomment [
await SKChunking.Run();
] on program.cs - Explore the code, as it does the following:
- Creates (or updates) an Azure AI Search Index.
- Reads the files and chunks them accordingly.
- Uploads chunks once every 20 files have been chunked.
- Since the docs are quite a lot, this can time significant time - feel free to stop it any time.
- Start asking the bot questions about the Azure docs that have been indexed.