End-to-End Medical Chatbot

This project is an end-to-end medical chatbot that leverages advanced AI technologies to provide medical assistance and information. The chatbot uses LangChain, Flask, GPT, and Pinecone for natural language understanding, knowledge retrieval, and conversational capabilities. It is designed to assist users in obtaining accurate medical information and can be deployed on AWS using CI/CD pipelines with GitHub Actions.

Project Objective

The objective of this project is to create a robust and scalable medical chatbot capable of answering medical queries, retrieving relevant information from a knowledge base, and providing actionable insights. The system integrates with Pinecone for storing embeddings and utilizes OpenAI's GPT for generating responses.

How to Run?

Follow these steps to run the project:

  1. Clone the repository:
  2. Project repo: https://github.com/
  3. Create a conda environment:
  4. conda create -n medichat python=3.10 -y
    conda activate medichat
  5. Install the requirements:
  6. pip install -r requirements.txt
  7. Create a .env file: Add your Pinecone & OpenAI credentials as follows:
  8. PINECONE_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    OPENAI_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  9. Run the following command to store embeddings to Pinecone:
  10. python store_index.py
  11. Finally, run the following command:
  12. python app.py
  13. Open up localhost:
  14. http://localhost:5000

Tech Stack Used:

  • Python
  • LangChain
  • Flask
  • GPT
  • Pinecone
  • AWS CICD Deployment with GitHub Actions

AWS Deployment Steps

To deploy the chatbot on AWS, follow these steps:

  1. Login to AWS Console: Create an IAM user for deployment with specific access (EC2 and ECR).
  2. Create an ECR Repository: Save the URI: 970547337635.dkr.ecr.ap-south-1.amazonaws.com/medicalchatbot.
  3. Create an EC2 Machine (Ubuntu): Install Docker and configure it as a self-hosted runner.
  4. Build and Push Docker Image: Build the Docker image of the source code and push it to ECR.
  5. Launch EC2 Instance: Pull the Docker image from ECR and launch it on the EC2 instance.
  6. Setup GitHub Secrets: Add the following secrets to GitHub for CI/CD integration:
    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_DEFAULT_REGION
    • ECR_REPO
    • PINECONE_API_KEY
    • OPENAI_API_KEY

Images from the Project

Medical Chatbot Interface
Pinecone Integration AWS Deployment Pipeline


View the Code