This project is a Retrieval-Augmented Generation (RAG) system built on top of the AWS Customer Agreement document.
The application allows users to ask natural language questions about the agreement and receive grounded answers generated from relevant document sections.
The system combines semantic search using FAISS and Sentence Transformers with Large Language Model (LLM) generation using Groq.
Scope: the current build indexes a single document (the AWS Customer Agreement). Multi-document support and reranking are listed under Future Improvements.
- PDF document parsing
- Text chunking and preprocessing
- Semantic embeddings using Sentence Transformers
- FAISS vector database for similarity search
- Context-aware answer generation using Groq LLM
- FastAPI backend
- SQLite query logging
- Analytics endpoint
- Streamlit user interface
- Swagger API documentation
Document Flow:
AWS Customer Agreement PDF
↓
POST /ingest
↓
PDF Parser
↓
Chunking
↓
Embeddings (all-MiniLM-L6-v2)
↓
FAISS Vector Store
--------------------------------
Query Flow:
User Query
↓
POST /ask
↓
Retriever (Top-K)
↓
Groq LLM
↓
Generated Answer
↓
SQLite Logging
--------------------------------
Analytics Flow:
SQLite Logs
↓
GET /analytics
↓
Streamlit Dashboard
- Python
- FastAPI
- SQLAlchemy
- SQLite
- Sentence Transformers (all-MiniLM-L6-v2)
- FAISS
- PyPDF
- Groq API
- Streamlit
git clone <repo-url>
cd vestaff-ragpython -m venv venvActivate:
venv\Scripts\activatepip install -r requirements.txtCreate a .env file:
GROQ_API_KEY=your_api_keypython -m backend.init_dbpython test_ingest.pyuvicorn backend.main:app --reloadSwagger:
http://127.0.0.1:8000/docs
python -m streamlit run frontend/app.pyHealth check endpoint.
Returns a simple message confirming that the API is running.
Processes and ingests the AWS Customer Agreement PDF.
This endpoint:
- Extracts text from the PDF
- Chunks the document into smaller sections
- Generates semantic embeddings using Sentence Transformers
- Builds and stores a FAISS vector index for retrieval
Returns:
- Success message
- Number of chunks created
Accepts a natural language query and executes the complete RAG pipeline.
Returns:
- Generated answer
- Retrieved source context
- Response latency
All interactions are automatically logged into the SQLite database for analytics.
Returns usage statistics generated from SQL queries on the interaction logs.
Returns:
- Total queries
- Unanswered queries
- Average response latency
- Most frequently asked questions
- What are the responsibilities of users regarding security and backup?
- What is AWS indemnification policy?
- Can AWS modify the agreement?
- What are the payment obligations?
The system logs every query in SQLite and tracks:
- Query count
- Answer success rate
- Average response latency
- Hybrid Retrieval (BM25 + FAISS)
- Reranking Layer
- Multi-document support
- Conversation Memory
- Docker Deployment