rohanjain1648 commited on
Commit
b4e2bdd
·
verified ·
1 Parent(s): 251e002

Delete README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -161
README.md DELETED
@@ -1,161 +0,0 @@
1
- # NVIDIA NIM RAG Demo
2
-
3
- A Streamlit-based Retrieval-Augmented Generation (RAG) application that uses NVIDIA AI endpoints to answer questions about PDF documents. This demo showcases the integration of NVIDIA's AI models for document embeddings and question answering.
4
-
5
- ## Features
6
-
7
- - **Document Processing**: Load and process PDF documents from a specified directory
8
- - **Vector Embeddings**: Generate embeddings using NVIDIA's `nv-embedqa-e5-v5` model
9
- - **Question Answering**: Answer questions using NVIDIA's Llama 3.3 70B model
10
- - **Retrieval-Augmented Generation**: Combine document retrieval with generative AI for accurate responses
11
- - **Interactive UI**: Clean Streamlit interface for easy interaction
12
- - **Error Handling**: Comprehensive error handling and user feedback
13
-
14
- ## Prerequisites
15
-
16
- - Python 3.8 or higher
17
- - NVIDIA API key (obtain from [NVIDIA AI Foundation Models](https://build.nvidia.com/explore/discover))
18
- - Internet connection for API calls
19
-
20
- ## Installation
21
-
22
- 1. Clone or download this repository
23
- 2. Navigate to the project directory
24
- 3. Create a virtual environment (recommended):
25
- ```bash
26
- python -m venv venv
27
- venv\Scripts\activate # On Windows
28
- # or
29
- source venv/bin/activate # On macOS/Linux
30
- ```
31
-
32
- 4. Install the required packages:
33
- ```bash
34
- pip install -r requirements.txt
35
- ```
36
-
37
- ## Setup
38
-
39
- 1. Create a `.env` file in the project root directory
40
- 2. Add your NVIDIA API key to the `.env` file:
41
- ```
42
- NVIDIA_API_KEY=your-api-key-here
43
- ```
44
- Replace `your-api-key-here` with your actual API key from NVIDIA.
45
-
46
- 3. Place your PDF documents in the `us_census/` directory (or modify the code to point to your document directory)
47
-
48
- ## Usage
49
-
50
- ### Running the Main Application
51
-
52
- Run the fixed and optimized version:
53
- ```bash
54
- streamlit run fixed_finalapp.py
55
- ```
56
-
57
- ### Alternative Versions
58
-
59
- - `streamlit_app.py`: Enhanced version with better error handling and user guidance
60
- - `finalapp.py`: Basic version with core functionality
61
- - `app.py`: Simple OpenAI-compatible API test script
62
-
63
- ### How to Use the App
64
-
65
- 1. Open the Streamlit app in your browser (usually at `http://localhost:8501`)
66
- 2. Click "Create Document Embeddings" to process the PDF documents
67
- 3. Wait for the embeddings to be created (this may take a few minutes for large document sets)
68
- 4. Enter your question in the text input field
69
- 5. View the AI-generated answer and relevant document excerpts
70
-
71
- ## Configuration
72
-
73
- ### Environment Variables
74
-
75
- - `NVIDIA_API_KEY`: Your NVIDIA API key (required)
76
-
77
- ### Document Directory
78
-
79
- The app loads PDFs from the `./us_census` directory by default. To change this:
80
- - Modify the `PyPDFDirectoryLoader` path in the `vector_embedding()` function
81
-
82
- ### Model Parameters
83
-
84
- You can adjust model parameters in the code:
85
- - Temperature: Controls randomness (0.0 to 1.0)
86
- - Max completion tokens: Maximum response length
87
- - Embedding model: Currently set to `nvidia/nv-embedqa-e5-v5`
88
- - LLM model: Currently set to `meta/llama-3.3-70b-instruct`
89
-
90
- ## Project Structure
91
-
92
- ```
93
- ├── app.py # Simple API test script
94
- ├── finalapp.py # Basic Streamlit RAG app
95
- ├── fixed_finalapp.py # Optimized Streamlit RAG app
96
- ├── streamlit_app.py # Enhanced Streamlit RAG app
97
- ├── requirements.txt # Python dependencies
98
- ├── .env # Environment variables (create this)
99
- ├── .env.example # Environment variables template
100
- ├── us_census/ # Directory for PDF documents
101
- │ ├── document1.pdf
102
- │ ├── document2.pdf
103
- │ └── ...
104
- ├── TODO.md # Development task tracking
105
- └── README.md # This file
106
- ```
107
-
108
- ## Dependencies
109
-
110
- Key libraries used:
111
- - `streamlit`: Web app framework
112
- - `langchain-nvidia-ai-endpoints`: NVIDIA AI model integration
113
- - `langchain-community`: Document loading and processing
114
- - `faiss-cpu`: Vector database for embeddings
115
- - `python-dotenv`: Environment variable management
116
- - `pypdf`: PDF document processing
117
-
118
- ## Troubleshooting
119
-
120
- ### Common Issues
121
-
122
- 1. **API Key Error**: Ensure your `.env` file contains a valid `NVIDIA_API_KEY`
123
- 2. **SSL Certificate Error**: The app uses the correct NVIDIA API endpoints; ensure internet connectivity
124
- 3. **Document Loading Error**: Check that PDF files exist in the specified directory
125
- 4. **Embedding Creation Failure**: Verify API key validity and internet connection
126
-
127
- ### Error Messages
128
-
129
- - "NVIDIA_API_KEY not found": Add your API key to the `.env` file
130
- - "No documents found": Ensure PDFs are in the correct directory
131
- - "Error creating embeddings": Check API key and network connection
132
-
133
- ## Contributing
134
-
135
- 1. Fork the repository
136
- 2. Create a feature branch
137
- 3. Make your changes
138
- 4. Test thoroughly
139
- 5. Submit a pull request
140
-
141
- ## License
142
-
143
- This project is for educational and demonstration purposes. Please check NVIDIA's terms of service for API usage.
144
-
145
- ## Acknowledgments
146
-
147
- - NVIDIA for providing AI endpoints
148
- - LangChain for the RAG framework
149
- - Streamlit for the web app framework
150
- - FAISS for vector similarity search
151
-
152
- ## Support
153
-
154
- For issues related to:
155
- - NVIDIA API: Visit [NVIDIA AI Foundation Models](https://build.nvidia.com/explore/discover)
156
- - LangChain: Check [LangChain documentation](https://python.langchain.com/)
157
- - Streamlit: See [Streamlit documentation](https://docs.streamlit.io/)
158
-
159
- ---
160
-
161
- **Note**: This is a demonstration application. For production use, consider implementing additional security measures, error handling, and performance optimizations.