|
| 1 | +# Setting up RAG using AI-services |
| 2 | + |
| 3 | +This section explains how to set up a RAG using the existing templates provided in AI-services. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +##### Fig 1.0 - RAG Chatbot Setup |
| 8 | + |
| 9 | +## Pull and Run the AI-services binary |
| 10 | + |
| 11 | +To get started, follow the [installation guide](./installation.md) to pull and run the AI-services binary. |
| 12 | + |
| 13 | +## Create an App Using the RAG Template |
| 14 | + |
| 15 | +Initialize a new application using the built-in template - RAG. It generates all essential resources required to configure and run a complete RAG workflow. |
| 16 | +You can also specify UI port for the chatbot using the --params flag (for example: --params UI_PORT=3000). If not provided, the system automatically assigns a free port for the chatbot UI. |
| 17 | + |
| 18 | +Provide a unique name for the application to ensure smooth deployment (replace with `<app-name>`). |
| 19 | + |
| 20 | +```bash |
| 21 | +$ ai-services application create <app-name> -t RAG --params UI_PORT=3000 |
| 22 | +``` |
| 23 | + |
| 24 | +**Replace 3000 with any port number you wish to use for rendering the UI.** |
| 25 | + |
| 26 | +After the `create` command completes successfully, the next steps will appear in the output. Alternatively, you can follow the instructions below. Make sure to replace `<app-name>` with your application name accordingly. |
| 27 | + |
| 28 | +## Place the Documents for Ingestion |
| 29 | + |
| 30 | +Add your source documents to the designated ingestion directory path -> `/var/lib/ai-services/<app-name>/docs/`. These files will be processed and indexed for retrieval by the RAG pipeline. |
| 31 | + |
| 32 | +## Start Document Ingestion |
| 33 | + |
| 34 | +Trigger the ingestion process to parse and upload the documents into DB. Once complete, the documents become searchable and ready for retrieval during chat interactions. |
| 35 | + |
| 36 | +```bash |
| 37 | +ai-services application start <app-name> --pod=<app-name>--ingest-docs |
| 38 | +``` |
| 39 | + |
| 40 | +## Access the Chatbot |
| 41 | + |
| 42 | +The chatbot URL is rendered on the terminal once the application is created and can also be viewed by using the `ai-service application info <app-name>` command. |
| 43 | + |
| 44 | +```bash |
| 45 | +$ ai-services application info rag-test |
| 46 | +Application Name: rag-test |
| 47 | +Application Template: RAG |
| 48 | +Version: 0.0.1 |
| 49 | +Info: |
| 50 | +------- |
| 51 | +Day N: |
| 52 | +1. Chatbot is available to use at http://10.20.177.252:3000 |
| 53 | +2. If you want to serve any more new documents via this RAG application, add them inside "/var/lib/ai-services/rag-test/docs" directory |
| 54 | +3. If you want to do the ingestion again, execute below command and wait for the ingestion to be completed before accessing the chatbot to query the new data. |
| 55 | +`ai-services application start rag-test --pod=rag-test--ingest-docs` |
| 56 | +4. In case if you want to clean the documents added to the db, execute below command |
| 57 | +`ai-services application start rag-test --pod=rag-test--clean-docs` |
| 58 | +``` |
0 commit comments