How entbappy/medical-agentic-chatbot works
MedGuide AI is an educational medical assistant exposed through a FastAPI service and vanilla-JavaScript UI. Users can submit questions, optional images, and conversation history; the chat endpoint obtains image observations, runs a retrieval-and-routing agent, and returns an answer with sources. Separate user capabilities provide speech transcription and spoken answers. A documented ingestion workflow chunks the historical PDF and indexes embeddings for retrieval. The graph follows relationships visible in excerpts or the README; unsampled template and knowledge details are represented only where documented.
Main entry points: main.py FastAPI endpoints · agent.py LangGraph agent · ingest.py PDF ingestion · app.js Chat UI
Components 14
Web experience
- Chat UI
static/app.js - Web page
templates/index.html - Speech controls
static/app.js
API service
- FastAPI endpoints
app/main.py - Configuration
app/config.py
Answer workflow
- LangGraph agent
app/agent.py - Conversation checkpoint
app/agent.py
Knowledge base
- PDF retrieval
app/knowledge.py - PDF ingestion
ingest.py - Medical reference PDF
data/Medical_book.pdf - Pinecone index
Media services
- OpenAI API
- Tavily search
Other components
- User
Connections 20
- User → Chat UI: uses
README.md - Chat UI → Web page: renders in
- Chat UI → FastAPI endpoints: calls chat
static/app.js - FastAPI endpoints → Configuration: checks settings
app/main.py - FastAPI endpoints → LangGraph agent: invokes
app/main.py - FastAPI endpoints → OpenAI API: requests image observations
app/main.py - FastAPI endpoints → Conversation checkpoint: sets thread ID
app/main.py - LangGraph agent → PDF retrieval: searches knowledge
app/agent.py - LangGraph agent → Tavily search: searches when routed
app/agent.py - LangGraph agent → OpenAI API: generates answer
README.md - LangGraph agent → Conversation checkpoint: persists state
app/agent.py - PDF retrieval → Pinecone index: queries index
app/knowledge.py - PDF retrieval → OpenAI API: embeds query
app/knowledge.py - PDF ingestion → Medical reference PDF: reads pages
ingest.py - PDF ingestion → PDF retrieval: uses embedding helpers
ingest.py - PDF ingestion → Pinecone index: upserts vectors
ingest.py - PDF ingestion → OpenAI API: embeds chunks
ingest.py - Chat UI → Speech controls: offers voice controls
static/app.js - Speech controls → FastAPI endpoints: calls speech endpoints
static/app.js - FastAPI endpoints → OpenAI API: transcribes and synthesizes
app/main.py