A Streamlit-based chatbot that uses NVIDIA NIM APIs for document embeddings and large language model (LLM) responses. It allows users to upload PDFs, generate embeddings with NVIDIA's endpoint, and ask contextual questions powered by Llama 3.3-70B Instruct.
- 🔍 Upload and process PDF files from the
./datadirectory - 🧠 Create document embeddings using
NVIDIAEmbeddings - 💬 Ask questions based on document context
- 🧾 View retrieved context documents
- 📊 Token and chunk statistics for debugging and transparency
- ⚡ Powered by
meta/llama-3.3-70b-instructvia NVIDIA's NIM APIs
- Streamlit
- LangChain
- NVIDIA NIM
- FAISS for vector storage
- tiktoken for token counting
.envfor environment variable management
.
├── data/ # PDF files go here
├── .env # NVIDIA_API_KEY goes here
├── app.py # Main Streamlit app
├── requirements.txt # Python dependencies
└── README.md # You're here!
- Load PDFs from the
./datafolder - Split text into chunks using
RecursiveCharacterTextSplitter - Filter out chunks exceeding token limits
- Generate embeddings using
NVIDIAEmbeddings - Store embeddings in FAISS vector store
- Ask questions, and the app retrieves relevant chunks and responds using LLM
On macOS/Linux:
python3 -m venv venv
source venv/bin/activate
On Windows:
python -m venv venv
venv\Scripts\activate
Make sure you're in the root directory of the project and run:
pip install -r requirements.txt
Create a .env file in the root directory with the following content:
NVIDIA_API_KEY=your_nvidia_api_key_here
Make sure to replace your_nvidia_api_key_here with your actual API key from NVIDIA NIM.
Place your PDF files inside the data/folder. The app will automatically load and process them.
Now launch the app using:
streamlit run app.py
- Click the "Document Embedding" button to process and embed documents.
- Enter a question in the input box to query your documents using LLM.
- View the retrieved context documents and response time.