An AI-powered assistant that helps doctors streamline appointment bookings and improve the overall patient experience.
This repo demonstrates practical use of LangChain, FastAPI, Qdrant, Retrieval-Augmented Generation (RAG), conversational memory, and custom tool integrations.
β Patients can ask for a doctor or describe their disease naturally. β RAG-based retrieval of doctor info from Qdrant. β Maintains chat history for contextual conversations. β Uses LangChain tools to save appointments. β Appointments stored in JSON file (easily replaceable with DB).
- User sends a query: "I have a skin disease."
- Assistant processes the query through the LLM (Gemini via LangGraph).
- Tool calling is triggered:
- Qdrant Vector Store β retrieves the most relevant doctor based on embeddings.
- Appointment Tool β handles date, time, and patient information.
- Chat history is appended and preserved across turns, so the assistant remembers context during the session.
- The assistant orchestrates the tools and combines results into a natural response.
- Data persistence:
- For now, appointments are saved in appointments.json.
- Future plan: replace with PostgreSQL + checkpointer for persistent history.
sequenceDiagram
participant U as User
participant A as AI Assistant
participant Q as Qdrant (Vector DB)
participant T as Tool (save_appointment)
U->>A: "I have a skin disease"
A->>Q: Retrieve doctor info
Q-->>A: Return relevant doctor (e.g. Dermatologist)
A->>U: Suggest doctor and ask for date/time/name
U->>A: Provides details
A->>T: Save appointment to appointments.json
T-->>A: Confirmation
A->>U: "Your appointment is booked with Dr. Sara"
#Langgraph Flow Diagram
+---------------------+
| START |
+---------------------+
|
v
+-------------------------------+
| response_with_tools |
+-------------------------------+
|
v
+-----------------+
| tool_node |
+-----------------+
/ \
/ \
v v
+-------------------+ +-------------------+
| response_without_ | | END |
| _tools | +-------------------+
+-------------------+
|
v
+-------------------+
| END |
+-------------------+
- LangChain + Langgraph β LLM orchestration
- FastAPI β API layer
- Qdrant β Vector DB for RAG
- Uvicorn β ASGI server
- JSON Tool β Appointment storage
git clone https://github.com/your-username/ai-doctor-assistant.git
cd ai-doctor-assistantpython -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windowspip install -r requirements.txtFirst, create a .env file in the project root and add the required environment variables (update values as needed):
uvicorn app.main:app --reloadYou can quickly test the assistant from the homepage.
Simply type a message (e.g., βI have a skin diseaseβ) in the chat box.
-
Add authentication & role-based access
-
Deploy with Docker + Nginx + Cloud (AWS/DigitalOcean)
-
Add a doctor registration page and injest data to qdrant
-
Replace JSON file storage with PostgreSQL
-
Use LangGraph instead of LangChain
-
Move document search to tools to enable document search only when needed
-
Implement PostgreSQL checkpointer for persistent chat history
-
Add routing to enable document search only when needed -
Add appointment search to check doctor's availability
Omar Faruk π§ omar.iut.09@gmail.com π LinkedIn
β If you found this project interesting, donβt forget to star this repo!