MEOW commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -1 +1,88 @@
|
|
| 1 |
-
# Multimodal_RAG_with_Nemo_Guardrails
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Multimodal_RAG_with_Nemo_Guardrails
|
| 2 |
+
|
| 3 |
+
# Practice Mulmimodal RAG using NVIDIA NIM, NVIDIA NeMo Guardrails, LlamaIndex, Milvus and Gradio UI
|
| 4 |
+
|
| 5 |
+
## Setup
|
| 6 |
+
|
| 7 |
+
1. Clone the repository:
|
| 8 |
+
```
|
| 9 |
+
git clone https://github.com/142CodeGreen/RAG-with-NeMo-Guardrails.git
|
| 10 |
+
cd RAG-with-NeMo-Guardrails
|
| 11 |
+
```
|
| 12 |
+
|
| 13 |
+
2. Install the required packages:
|
| 14 |
+
```
|
| 15 |
+
pip install --upgrade -r requirements.txt
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
+
3. Export API keys. NVIDIA_API_KEY is for NVIDIA NIM, while OpenAI API Key is needed for Nemo Guardrails.
|
| 19 |
+
```
|
| 20 |
+
export NVIDIA_API_KEY="your-api-key-here"
|
| 21 |
+
echo $NVIDIA_API_KEY
|
| 22 |
+
|
| 23 |
+
export OPENAI_API_KEY="your-openai-key-here"
|
| 24 |
+
echo $OPENAI_API_KEY
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
4. Run the app.py:
|
| 28 |
+
```
|
| 29 |
+
python3 app.py
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
## Optional: use GPU-accelerated Milvus container:
|
| 33 |
+
|
| 34 |
+
1. Refer this [tutorial](https://milvus.io/docs/install_standalone-docker-compose-gpu.md) to install required environments for GPU-accelerated Milvus container, including:
|
| 35 |
+
- Docker
|
| 36 |
+
- NVIDIA Docker container tool kit & NVIDIA Driver
|
| 37 |
+
|
| 38 |
+
To utilize GPU acceleration in the vector database, ensure that:
|
| 39 |
+
- Your system has a compatible NVIDIA GPU.
|
| 40 |
+
- You're using the GPU-enabled version of Milvus (as shown in the step 2 below).
|
| 41 |
+
- There are enough concurrent requests to justify GPU usage. GPU acceleration typically shows significant benefits under high load conditions.
|
| 42 |
+
|
| 43 |
+
2. It's important to note that GPU acceleration will only be used when the incoming requests are extremely high. For more detailed information on GPU indexing and search in Milvus, refer to the [official Milvus GPU Index documentation](https://milvus.io/docs/gpu_index.md).
|
| 44 |
+
|
| 45 |
+
To connect the GPU-accelerated Milvus with LlamaIndex, update the MilvusVectorStore configuration in app.py:
|
| 46 |
+
|
| 47 |
+
```
|
| 48 |
+
vector_store = MilvusVectorStore(
|
| 49 |
+
host="127.0.0.1",
|
| 50 |
+
port=19530,
|
| 51 |
+
dim=1024,
|
| 52 |
+
collection_name="your_collection_name",
|
| 53 |
+
gpu_id=0, # Specify the GPU ID to use
|
| 54 |
+
output_fields=["field1","field2"]
|
| 55 |
+
)
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
3. Upon above environment set up, start the GPU-accelerated Milvus container:
|
| 59 |
+
```
|
| 60 |
+
sudo docker compose up -d
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
4. Ensure the Milvus container is running:
|
| 64 |
+
|
| 65 |
+
```
|
| 66 |
+
docker ps
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
5. Run the app.py:
|
| 70 |
+
```
|
| 71 |
+
python3 app.py
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
- Open the provided URL in your web browser.
|
| 75 |
+
|
| 76 |
+
- Upload PDF file librarie and set up the environment context.
|
| 77 |
+
|
| 78 |
+
- Process the files by clicking the "Upload PDF" button.
|
| 79 |
+
|
| 80 |
+
- Once processing is complete, use the chat interface to query your documents.
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
## File Structure
|
| 84 |
+
|
| 85 |
+
- Config folder to store the yaml, colang files of NeMo Guardrails.
|
| 86 |
+
- `app.py`: Main application ( if you follow the step-by-step script, do not run the app.py)
|
| 87 |
+
- `requirements.txt`: List of application dependencies
|
| 88 |
+
|