Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฉบ MedStudy AI Pro: Production-Grade Medical RAG Engine

Python Streamlit LangChain HuggingFace License

MedStudy AI Pro is a high-precision, context-isolated Retrieval-Augmented Generation (RAG) system engineered to ingest dense medical manuscripts and generate hallucination-resistant insights. Optimized for clinical precision, the platform mitigates cross-document context bleeding, optimizes memory utilization, and enforces rigid source grounding.

๐Ÿ—๏ธ System Architecture & Data Flow

[User Uploads PDF] 
       โ”‚
       โ–ผ
[In-Memory Text Extraction] โ”€โ”€โ–บ Non-blocking PyPDFLoader stream
       โ”‚
       โ–ผ
[Optimized Semantic Chunking] โ”€โ”€โ–บ RecursiveCharacterSplitter (1000 tokens | 200 overlap)
       โ”‚
       โ–ผ
[HuggingFace Embeddings] โ”€โ”€โ–บ Model: all-MiniLM-L6-v2 (384-dim dense vectors)
       โ”‚
       โ–ผ
[In-Memory Vector Store] โ”€โ”€โ–บ ChromaDB/FAISS (Strict Ephemeral Isolation)
       โ”‚
       โ–ผ
[Llama-3.3-70B Pipeline] โ”€โ”€โ–บ Temperature: 0.1 + Deterministic Grounding Prompt
       โ”‚
       โ–ผ
[Streamlit UI Rendering] โ”€โ”€โ–บ Chat Interface + Verified Fragment Citations

๐Ÿ“ธ Application Interface

App Demo

๐Ÿš€ Technical Breakthroughs & Infrastructure During the development of MedStudy AI Pro, several high-impact cloud infrastructure challenges were systematically engineered away:

๐Ÿ”’ Zero-Leakage Ephemeral Storage Standard vector databases persist data to disk, running a risk of context bleeding across separate user files. This engine decouples document tracking by spinning up an isolated, dynamic, in-memory index.

๐ŸŒ Bypassing Iframe 403 Rejections Cloud platform dashboards often isolate web frameworks behind <iframe> layers. This project routes user traffic directly to the raw application container network socket.

๐Ÿง  Anti-Hallucination Grounding Framework To safely handle delicate clinical data, the inference pipeline utilizes a low-temperature constraint (T = 0.1) coupled with deterministic system instructions.

๐Ÿ› ๏ธ Deep Tech Stack LLM: llama-3.3-70b-versatile via high-speed LPU inference (Groq Cloud). Orchestration: LangChain Core (RunnablePassthrough, ChatPromptTemplate). Vector Embeddings: HuggingFace all-MiniLM-L6-v2. Vector Store: ChromaDB / FAISS (In-Memory Implementation). Frontend: Streamlit Framework (State Handling Session Hooks).

๐Ÿ“ฆ Installation & Developer Setup

  1. Prerequisites Python 3.10 or higher. A Groq Cloud API Key.

  2. Setup code Bash git clone https://github.com/AYESHAASS/Medical-RAG-Assistant.git cd Medical-RAG-Assistant python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install -r requirements.txt

  3. Environment Create a .env file in the root directory: code Text GROQ_API_KEY=your_production_low_latency_groq_api_token

  4. Run code Bash streamlit run app.py

๐Ÿ”ฌ Rigorous Test Cases Passed The system was evaluated against empirical medical literature to verify retrieval stability across three core stress vectors: Exact Metric Ingestion: Successfully extracted complex statistics (e.g., 95% Confidence Intervals and Brier Scores) from compressed markdown tables.

Multi-Hop Synthesis: Mapped multi-layer neural network parameters (128, 64, 32) across distributed framework logs. Out-of-Bounds Refusals: Corrected handled negative testing by refusing to answer questions not present in the uploaded manuscript.

โš–๏ธ Disclaimer This tool is for educational and research purposes only. It is not intended for clinical decision-making. Always consult primary clinical guidelines and human experts before making medical decisions.

๐Ÿ“œ License Distributed under the MIT License. See LICENSE for more information.

About

๐Ÿฉบ A production-grade, hallucination-resistant RAG engine for medical manuscripts. Built with LangChain, Llama-3.3-70B, and FAISS for clinical precision.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages