Skip to content

Matei-Gatin/AIMedicalAssistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🩺 RAG Medical AI Assistant

An intelligent medical chatbot powered by Retrieval-Augmented Generation (RAG) that helps healthcare professionals and patients get accurate answers from uploaded medical documents.

✨ Features

  • 📄 PDF Document Upload: Upload multiple medical PDFs to build your knowledge base
  • 🤖 AI-Powered Chat: Ask questions and get contextual answers from your documents
  • 🔍 Source Attribution: See which documents your answers come from
  • 💾 Chat History: Download your conversation history for record keeping
  • ⚡ Real-time Processing: Fast document indexing and query responses
  • 🌐 Web Interface: Clean, intuitive Streamlit frontend

🏗️ Architecture

This project uses a modern microservices architecture:

  • Frontend: Streamlit web application (client/)
  • Backend: FastAPI REST API (server/)
  • Vector Database: Pinecone for document embeddings
  • LLM: Google Generative AI (Gemini)
  • Embeddings: Google Generative AI Embeddings

🚀 Quick Start

Prerequisites

  • Python 3.13+
  • UV package manager
  • Pinecone API key
  • Google AI API key

Installation

  1. Clone the repository

    git clone <your-repo-url>
    cd RAGMedicalAIAssistant
  2. Set up virtual environment

    uv venv
    .venv\Scripts\activate  # Windows
    # or
    source .venv/bin/activate  # macOS/Linux
  3. Install dependencies

    uv pip install -r requirements.txt
  4. Environment setup Create a .env file in the root directory:

    PINECONE_API_KEY=your_pinecone_api_key
    PINECONE_INDEX_NAME=your_index_name
    GOOGLE_API_KEY=your_google_ai_api_key

Running the Application

  1. Start the FastAPI backend

    uvicorn main:app --reload

    Backend will be available at http://localhost:8000

  2. Start the Streamlit frontend

    cd client
    streamlit run app.py

    Frontend will be available at http://localhost:8501

📱 Usage

  1. Upload Documents: Use the sidebar to upload medical PDF documents
  2. Wait for Processing: Documents are automatically processed and indexed
  3. Ask Questions: Type your medical questions in the chat interface
  4. Get Answers: Receive AI-generated responses based on your documents
  5. Download History: Save your chat history for future reference

🛠️ Project Structure

RAGMedicalAIAssistant/
├── client/                 # Streamlit frontend
│   ├── components/         # UI components
│   │   ├── chatUI.py      # Chat interface
│   │   ├── upload.py      # File upload component
│   │   └── history_download.py
│   ├── utils/             # Client utilities
│   │   └── api.py         # API client functions
│   ├── config.py          # Client configuration
│   └── app.py             # Main Streamlit app
├── server/                # FastAPI backend
│   ├── routes/            # API endpoints
│   ├── modules/           # Core business logic
│   ├── middlewares/       # Custom middleware
│   └── logger.py          # Logging configuration
├── main.py                # FastAPI application entry point
├── requirements.txt       # Python dependencies
└── README.MD             # This file

🔧 API Endpoints

  • POST /upload_pdfs/ - Upload and process PDF documents
  • POST /ask - Submit questions and get AI responses

🧪 Technologies Used

  • Frontend: Streamlit, Python
  • Backend: FastAPI, Uvicorn
  • AI/ML: LangChain, Google Generative AI
  • Vector Database: Pinecone
  • Document Processing: PyPDF
  • Environment: UV, Python-dotenv

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🚨 Disclaimer

This tool is for educational and informational purposes only. Always consult with qualified healthcare professionals for medical advice and decisions.

📞 Support

If you encounter any issues or have questions, please open an issue on GitHub.


Built with ❤️ for the healthcare community

About

AI Medical Assistant is a RAG chatbot that lets clinicians, students, and patients ask grounded questions about their own medical documents. Upload PDFs, chat naturally, and get clear, context‑aware answers sourced from your files.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages