|
| 1 | + |
| 2 | + |
| 3 | +Livestream starting soon! **Click below to register.** |
| 4 | + |
| 5 | +[](https://developer.microsoft.com/en-us/reactor/events/26775/) |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +In this quest, you will set up and run a **Serverless Retrieval-Augmented Generation (RAG)** support system using the provided codebase. Once you have completed the setup, you will start a CodeTour that will guide you through each step of the RAG implementation with detailed explanations. |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +## Steps to Complete the Quest |
| 14 | + |
| 15 | +### Codebase Setup |
| 16 | + |
| 17 | +1. **Fork and Clone the Repository**: Start by [forking](https://github.com/Azure-Samples/serverless-chat-langchainjs/fork) the Serverless RAG with LangChain repository to your GitHub account and then clone it. |
| 18 | + |
| 19 | + ```bash |
| 20 | + git clone https://github.com/<your-username>/serverless-chat-langchainjs.git |
| 21 | + ``` |
| 22 | + |
| 23 | + Navigate to the project directory: |
| 24 | + |
| 25 | + ```bash |
| 26 | + cd serverless-chat-langchainjs |
| 27 | + ``` |
| 28 | + |
| 29 | +2. **Download Ollama** (if you haven't already): You won't need to deploy to Azure for this quest, but you will need to connect to local models for text completions and embeddings. |
| 30 | + |
| 31 | + > [!NOTE] |
| 32 | + > Foundry Local doesn't support embeddings models yet, so you'll need to use Ollama for this quest. |
| 33 | + |
| 34 | + Download and install Ollama from [ollama.com](https://ollama.com/). |
| 35 | + |
| 36 | +3. **Pull the Required Models**: Open your terminal and run the following commands to pull the necessary models for text completions and embeddings: |
| 37 | + |
| 38 | + ```bash |
| 39 | + ollama pull llama3.1:latest |
| 40 | + ollama pull nomic-embed-text:latest |
| 41 | + ``` |
| 42 | +4. **Install Dependencies**: Install the required project dependencies using: |
| 43 | + |
| 44 | + ```bash |
| 45 | + npm install |
| 46 | + ``` |
| 47 | + |
| 48 | +5. **Start the Application**: |
| 49 | + |
| 50 | + Launch the application with: |
| 51 | + |
| 52 | + ```bash |
| 53 | + npm start |
| 54 | + ``` |
| 55 | + |
| 56 | + Then, in a separate terminal, run the following command to upload the PDF documents from the `/data` folder to the API: |
| 57 | + |
| 58 | + ```bash |
| 59 | + npm run upload:docs |
| 60 | + ``` |
| 61 | + |
| 62 | + Interact with the application by asking questions related to the uploaded documents and observe how the RAG system retrieves and generates responses based on the content. |
| 63 | + |
| 64 | + > [!NOTE] |
| 65 | + > While local models usually work well enough to answer the questions, sometimes they may not be able to perfectly follow the advanced formatting instructions for the citations and follow-up questions. |
| 66 | + > |
| 67 | + > This is expected, and a limitation of using smaller local models. |
| 68 | + |
| 69 | +### Start the CodeTour |
| 70 | + |
| 71 | +This quest is designed to give you a guided tour of the codebase and its implementation of the complete RAG pipeline. To start the CodeTour: |
| 72 | + |
| 73 | +1. **Install the CodeTour Extension**: If you haven't already, install the [CodeTour extension](https://marketplace.visualstudio.com/items?itemName=vsls-contrib.codetour) in Visual Studio Code. |
| 74 | +
|
| 75 | +2. **Open the CodeTour**: Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac) and type "**CodeTour: Start Tour**". |
| 76 | +
|
| 77 | +  |
| 78 | +
|
| 79 | +There are 6 tours to walk you through the entire RAG implementation flow. We recommend going through them in order as they build upon each other. |
| 80 | +
|
| 81 | +- Tour 1: RAG Architecture (10 steps) |
| 82 | +- Tour 2: Document Ingestion (10 steps) |
| 83 | +- Tour 3: Vector Storage (8 steps) |
| 84 | +- Tour 4: Query & Retrieval (7 steps) |
| 85 | +- Tour 5: Response Generation (7 steps) |
| 86 | +- Tour 6: Streaming & Chat History (8 steps) |
| 87 | +
|
| 88 | +### Return to the Build-a-thon |
| 89 | +
|
| 90 | +Once you have completed the CodeTour and explored the RAG implementation, return to the main Build-a-thon repository to continue with the next quests. |
| 91 | +
|
| 92 | +## Stay connected |
| 93 | +
|
| 94 | +Have a question, project or insight to share? Post in the [RAG discussion hub](https://github.com/Azure-Samples/JavaScript-AI-Buildathon/discussions/89) |
| 95 | +
|
| 96 | +## AI Note |
| 97 | +
|
| 98 | +This quest was partially created with the help of AI. The author reviewed and revised the content to ensure accuracy and quality. |
0 commit comments