Skip to content

Hiba-Basheer/PyDocQ-A

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PyDocQ&A 🧠

An Optimized RAG System for Python Documentation

PyDocQ&A is a Retrieval-Augmented Generation (RAG) application that enables fast, accurate question answering over Python documentation using semantic search and a transformer-based language model.
The system is designed with a clear separation between offline indexing and online querying to ensure low-latency responses.


πŸš€ Features

  • Semantic search over Python documentation using FAISS
  • Efficient text embeddings via Sentence Transformers
  • Transformer-based answer generation using FLAN-T5
  • One-time offline embedding and indexing for performance optimization
  • Interactive Streamlit chat interface
  • Modular, production-style project structure

πŸ—οΈ Architecture Overview

Python Docs (.txt)
↓
Document Chunking
↓
Sentence Embeddings
↓
FAISS Vector Index (Persisted)
↓
Query Embedding
↓
Top-K Semantic Retrieval
↓
Context Injection
↓
LLM Answer Generation

πŸ“‚ Project Structure

PyDocQ&A/
β”‚
β”œβ”€β”€ artifacts/
β”‚ β”œβ”€β”€ faiss.index # FAISS vector index
β”‚ └── chunks.pkl # Chunked document metadata
β”‚
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ load_and_chunk.py # Load and chunk text documents
β”‚ β”œβ”€β”€ embeddings.py # Create sentence embeddings
β”‚ β”œβ”€β”€ build_index.py # One-time FAISS index builder
β”‚ β”œβ”€β”€ qa_chain.py # CLI-based question answering
β”‚ └── app.py # Streamlit UI application
β”‚
β”œβ”€β”€ .gitignore
β”œβ”€β”€ requirements.txt
└── README.md

βš™οΈ Tech Stack

  • Python
  • FAISS – Vector similarity search
  • SentenceTransformers – Text embeddings
  • Transformers (FLAN-T5) – Answer generation
  • Streamlit – Web UI
  • LangChain – Document and text utilities

πŸ“Œ Data & Artifacts Note

Raw Python documentation files are excluded from the repository to keep it lightweight and reproducible.

Precomputed FAISS indexes and processed artifacts are included to enable instant evaluation and fast querying without rebuilding embeddings.

πŸ“ˆ Performance Optimization

Stage	           Naive Approach	     Optimized Approach
Embedding	       Every run	         One-time offline
Indexing	       Every run	         Persisted FAISS
Query latency	   Minutes	            ~1–2 seconds
Startup time	   High	                Low

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages