# ๐Ÿค– AI Engineering Portfolio A structured, end-to-end AI engineering roadmap covering three production-focused projects โ€” from document intelligence and multimodal processing to AI safety and red-teaming. Each project is built with real architecture, not tutorial code. --- ## ๐Ÿ“‚ Repository Structure ``` โ”œโ”€โ”€ rag-system/ # Phase 1 โ€” Chat with PDF (RAG Pipeline) โ”œโ”€โ”€ multimodal-engine/ # Phase 2 โ€” AI Reel Generator (Multimodal) โ”œโ”€โ”€ ai-saftey-audit/ # Phase 3 โ€” Safety & Bias Evaluation Toolkit โ”œโ”€โ”€ requirements.txt # Shared top-level dependencies โ””โ”€โ”€ README.md ``` --- ## ๐Ÿ—บ๏ธ Project Overview ### Phase 1 โ€” RAG System โœ… Complete **`/rag-system`** A production-grade Retrieval-Augmented Generation pipeline. Upload any PDF and have a grounded, citation-backed conversation with its contents. Features a multi-LLM fallback chain (Ollama โ†’ HuggingFace โ†’ OpenAI โ†’ Google Gemini), persistent ChromaDB vector storage, sentence-aware chunking, and a full Streamlit chat UI. **Status:** Fully functional with Streamlit UI, CLI runner, and diagnostic test suite. --- ### Phase 2 โ€” Multimodal Engine ๐Ÿ”ง In Progress **`/multimodal-engine`** An AI engine designed to process, analyze, and generate content across multiple data types โ€” text, images, and audio. The core objective is building automated pipelines that link transcription, summarization, and video processing into a single workflow. **Planned Deliverable:** AI Reel Generator โ€” takes long-form video/audio, transcribes it, identifies key moments, and outputs a short-form highlight reel. **Status:** Architecture planned. Implementation in progress. --- ### Phase 3 โ€” AI Safety Audit ๐Ÿ”ง In Progress **`/ai-saftey-audit`** An alignment and auditing framework for stress-testing LLMs against adversarial inputs. Covers prompt injection defense, bias and fairness auditing, toxicity guardrails, and jailbreak red-teaming. **Planned Deliverable:** AI Safety Audit Report + automated testing framework. **Status:** Architecture planned. Implementation in progress. --- ## ๐Ÿ—๏ธ Architecture Overview ```text โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ AI ENGINEERING PORTFOLIO โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ โ”‚ โ”‚ Phase 1: RAG System โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ loader โ”‚โ”€โ”€โ–บโ”‚ chunker โ”‚โ”€โ”€โ–บโ”‚embedding โ”‚โ”€โ”€โ–บโ”‚ ChromaDB โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ โ”‚Streamlit โ”‚โ—„โ”€โ”€โ”‚qa_pipeln โ”‚โ—„โ”€โ”€โ”‚ retriever โ”‚โ—„โ”˜ โ”‚ โ”‚ โ”‚ UI โ”‚ โ”‚(LLM chainโ”‚ โ”‚ (distance filter)โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ โ”‚ โ”‚ Phase 2: Multimodal Engine (Planned) โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ Video โ”‚โ”€โ”€โ–บโ”‚ Whisper โ”‚โ”€โ”€โ–บโ”‚Summarize โ”‚โ”€โ”€โ–บโ”‚Reel Output โ”‚ โ”‚ โ”‚ โ”‚ Input โ”‚ โ”‚(Transcr.)โ”‚ โ”‚ (LLM) โ”‚ โ”‚ Generator โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ โ”‚ โ”‚ Phase 3: AI Safety Audit (Planned) โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ Prompt โ”‚โ”€โ”€โ–บโ”‚ Injectionโ”‚โ”€โ”€โ–บโ”‚ Bias โ”‚โ”€โ”€โ–บโ”‚ Audit โ”‚ โ”‚ โ”‚ โ”‚ Red-Team โ”‚ โ”‚ Defense โ”‚ โ”‚ Scanner โ”‚ โ”‚ Report โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` --- ## โœ… Features by Project ### RAG System - PDF text extraction with regex-based cleaning (pypdf) - NLTK sentence-aware chunking (no mid-sentence cuts) - Semantic embeddings via `all-MiniLM-L6-v2` (HuggingFace) - Persistent ChromaDB vector store - Distance-filtered retrieval (cosine similarity threshold) - Multi-LLM fallback: Ollama โ†’ HuggingFace โ†’ OpenAI โ†’ Google Gemini - Strictly grounded prompt โ€” LLM cannot answer outside retrieved context - Page-level citations with text snippets and distance scores - Full Streamlit chat UI with session state management - Chunk quality diagnostic tooling ### Multimodal Engine _(planned)_ - Audio transcription via OpenAI Whisper - LLM-powered content summarization - Automated video timeline slicing - Cross-modal search (text query โ†’ image/video results) - Unified API for vision and language models ### AI Safety Audit _(planned)_ - Prompt injection detection and filtering - Automated bias and fairness test suites - Toxicity evaluation layer - Jailbreak red-teaming framework - Structured audit report generation --- ## ๐Ÿ› ๏ธ Tech Stack | Category | Technologies | | -------------- | -------------------------------------------------------- | | Language | Python 3.10+ | | UI | Streamlit | | LLM โ€” Local | Ollama (llama3) | | LLM โ€” Cloud | OpenAI GPT-4o-mini, Google Gemini 2.5 Flash | | Embeddings | HuggingFace `sentence-transformers` (`all-MiniLM-L6-v2`) | | Vector DB | ChromaDB | | PDF Parsing | pypdf | | Text Splitting | LangChain, NLTK | | Audio/Video | OpenAI Whisper _(Phase 2)_ | | Safety/Eval | Custom framework + `ragas` _(Phase 3)_ | | Environment | python-dotenv | | Security | cryptography, pyjwt | --- ## ๐Ÿ“ฆ Installation **1. Clone the repository** ```bash git clone https://github.com/ajme-abes/RAG-Multimodal-SafeAI.git cd your-repo ``` **2. Create and activate a virtual environment** ```bash python -m venv venv # Windows venv\Scripts\activate # macOS / Linux source venv/bin/activate ``` **3. Install shared dependencies** ```bash pip install -r requirements.txt ``` **4. Set up environment variables** Create a `.env` file in the root directory: ```env OPENAI_API_KEY=your_openai_key_here GOOGLE_API_KEY=your_google_key_here HF_API_KEY=your_huggingface_key_here ``` --- ## ๐Ÿš€ Usage ### Run the RAG System ```bash cd rag-system/app streamlit run app.py ``` See [`rag-system/README.md`](./rag-system/README.md) for full setup and usage details. ### Run Diagnostic Tests ```bash # Chunk quality audit python rag-system/test/inspect_chunk.py # Semantic search test python rag-system/test/test_search.py # Vector DB connection test python rag-system/test/testdb_load.py ``` --- ## ๐Ÿ–ผ๏ธ Screenshots > _Screenshots will be added as each phase is completed._ > > **RAG System** โ€” Streamlit chat UI with PDF upload, Q&A, and citation panel > **Multimodal Engine** โ€” Video input โ†’ transcript โ†’ reel output workflow > **AI Safety Audit** โ€” Red-team test results and bias audit report --- ## ๐Ÿ“ˆ Roadmap ### Phase 1 โ€” RAG System - [x] PDF loader with text cleaning - [x] NLTK sentence-aware chunker - [x] HuggingFace embedding model - [x] ChromaDB persistent vector store - [x] Distance-filtered retriever - [x] Multi-LLM fallback chain (Ollama / HF / OpenAI / Gemini) - [x] Streamlit chat UI with citations - [ ] Conversation memory (chat history in prompt) - [ ] Streaming LLM responses - [ ] Multi-document support - [ ] Confidence gate (block hallucination on off-topic queries) - [ ] Cross-encoder reranking - [ ] FastAPI backend - [ ] Docker deployment ### Phase 2 โ€” Multimodal Engine - [ ] Whisper audio transcription - [ ] LLM summarization pipeline - [ ] Video clip extraction - [ ] Reel generator output - [ ] Cross-modal search API ### Phase 3 โ€” AI Safety Audit - [ ] Prompt injection test suite - [ ] Bias and fairness scanner - [ ] Toxicity guardrail layer - [ ] Jailbreak red-team framework - [ ] Automated audit report generator --- ## ๐Ÿ”ฎ Future Improvements - **RAG Evaluation** โ€” Integrate `ragas` to score faithfulness, answer relevancy, and context recall across all three phases - **Unified API Gateway** โ€” Single FastAPI service exposing all three systems under one interface - **Docker Compose** โ€” One-command deployment for the entire portfolio stack - **CI/CD Pipeline** โ€” GitHub Actions for automated testing and linting on every push - **Async Processing** โ€” Parallelize embedding and inference for production-scale throughput - **Web Scraping Ingestion** โ€” Extend the RAG loader to ingest URLs and web pages, not just PDFs --- ## ๐Ÿ‘ค Author Built as part of a structured AI engineering internship roadmap โ€” progressing from RAG fundamentals through multimodal systems to AI safety and evaluation.