This project is a Question Answering (QA) system that leverages Google Gemini LLM and document embeddings using llama-index. It enables semantic search and question answering over your own documents, with an interactive Jupyter notebook and a Streamlit app for experimentation.
- Document Ingestion: Load and process documents from a directory.
- Embeddings: Use Gemini embeddings for semantic understanding.
- LLM Integration: Query Google Gemini LLM for answers.
- Indexing: Build a vector store index for efficient retrieval.
- Interactive Notebook: Step-by-step code in
notebooks/expriments.ipynb. - Streamlit App: User-friendly interface for QA (see
notebooks/StreamlitApp.py).
qasystem/
│
├── Data/ # Place your PDF or text documents here
├── QAWithPDF/ # Core modules (if any)
├── notebooks/
│ ├── expriments.ipynb # Main Jupyter notebook
│ └── StreamlitApp.py # Streamlit app for QA
├── requirements.txt # Python dependencies
└── README.md # Project documentation
-
Clone the repository:
git clone https://github.com/yourusername/qasystem.git cd qasystem -
Install dependencies:
pip install -r requirements.txt
-
Set up your Google API key:
- Create a
.envfile in the root directory. - Add your key:
GOOGLE_API_KEY=your_google_api_key_here
- Create a
- Place your documents (PDFs, text files) in the
Data/directory. - Open
notebooks/expriments.ipynbin Jupyter. - Run the cells to:
- Load your API key and dependencies.
- List available Gemini models.
- Load and preview your documents.
- Initialize Gemini LLM and embedding models.
- Build the vector index.
- Query the index with natural language questions.
To run the Streamlit app for a web-based interface:
streamlit run notebooks/StreamlitApp.py- Load API Key:
Usesdotenvto securely load your Google API key. - List Gemini Models:
See which Gemini models are available for use. - Document Loading:
Reads all files from theData/directory. - Embedding & Indexing:
Embeds documents and builds a vector index. - Querying:
Ask questions like"What is X?"and get answers from your documents.
See requirements.txt for all dependencies, including:
- llama-index
- google-generativeai
- llama-index-llms-gemini
- pypdf
- python-dotenv
- IPython
- streamlit
Author: Aditya Sethi