A conversational AI agent that helps call center agents navigate insurance verification processes using RAG (Retrieval-Augmented Generation) on uploaded insurance documents.
- Conversational Interface: User-friendly chat interface for lay users
- Threaded Conversations: Support for multiple conversation threads
- Conversation Memory: Maintains context throughout conversations
- Plan Context Awareness: Always tracks which insurance plan is being discussed
- RAG on Documents: Performs retrieval-augmented generation on uploaded insurance documents
- Intelligent Chunking: Document chunking that preserves policy/plan context
- Backend: FastAPI (Python)
- Frontend: Next.js (React)
- LLM: OpenAI (GPT-4, embeddings)
- Vector Database: Chroma (can be swapped for Pinecone, Qdrant, etc.)
- Document Processing: LangChain, PyPDF2, python-docx
.
├── backend/ # FastAPI backend
│ ├── app/
│ │ ├── api/ # API routes
│ │ ├── core/ # Core configuration
│ │ ├── models/ # Database models
│ │ ├── services/ # Business logic
│ │ │ ├── rag.py # RAG service
│ │ │ ├── document_processor.py # Document chunking
│ │ │ └── conversation_manager.py # Thread & memory management
│ │ └── main.py # FastAPI app entry point
│ ├── requirements.txt
│ └── .env.example
├── frontend/ # Next.js frontend
│ ├── app/ # Next.js app directory
│ ├── components/ # React components
│ ├── lib/ # Utilities
│ └── package.json
└── README.md
Having trouble getting started? Check out the detailed SETUP.md guide or use the automated startup scripts:
# Check your setup first
./check-setup.sh
# Start backend (in one terminal)
./start-backend.sh
# Start frontend (in another terminal)
./start-frontend.shNote: If the scripts aren't executable, run chmod +x *.sh first.
- Navigate to backend directory:
cd backend- Create virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Copy
.env.exampleto.envand fill in your OpenAI API key:
cp .env.example .env- Initialize database:
python -c "from app.core.database import Base, engine; Base.metadata.create_all(bind=engine)"- Run the backend:
uvicorn app.main:app --reload- Navigate to frontend directory:
cd frontend- Install dependencies:
npm install- Create
.env.local(optional):
NEXT_PUBLIC_API_URL=http://localhost:8000- Run the frontend:
npm run devOPENAI_API_KEY: Your OpenAI API keyDATABASE_URL: Database connection string (for conversation storage)VECTOR_DB_PATH: Path for Chroma vector databaseMAX_CHUNK_SIZE: Maximum chunk size for document processingCHUNK_OVERLAP: Overlap between chunks
- Each conversation thread is associated with a specific insurance plan
- Plan context is maintained throughout the conversation
- Document chunks are tagged with plan identifiers
- RAG retrieval filters by plan context
- Semantic chunking that preserves policy/plan context
- Chunks include metadata: plan_id, section, page numbers
- Overlapping chunks to maintain context boundaries
- Special handling for tables and structured data
- Short-term: Last N messages in conversation
- Long-term: Summarized conversation history
- Plan context: Always included in system prompts
POST /api/conversations- Create new conversation threadGET /api/conversations/{thread_id}- Get conversation historyPOST /api/conversations/{thread_id}/messages- Send messagePOST /api/documents/upload- Upload insurance documentsGET /api/documents- List uploaded documentsDELETE /api/documents/{doc_id}- Delete documentPOST /api/chat/message- Send chat message and get AI response
See individual README files in backend/ and frontend/ directories for more details.