MedMarket AI
AI-powered sales platform for medical procedures with RAG chatbot that negotiates prices and recommends doctors.
Tech Stack
Key Highlights
RAG with PostgreSQL + pgvector for medical knowledge
Dialogue state machine with slot-filling and tool calls
Smart negotiation engine with safety rails and audit logs
ETL pipeline from Excel/docs to embeddings
Per-turn traces and cost tracking for observability
Multilingual-e5-base embeddings (dim=768)
Project Details
I built a vertical marketplace backend with an AI sales assistant that answers patient questions, recommends doctors, and negotiates price under guardrails—powered by RAG (PostgreSQL + pgvector) and Gemini.
**RAG over domain corpus:** Device specs, procedure guides, clinic/doctor profiles; embeddings with multilingual-e5-base (dim=768) stored in PostgreSQL + pgvector.
**Dialogue state machine:** transitions library drives greeting → procedure selection → doctor match → negotiation → booking intent with slot-filling and tool calls.
**Negotiation engine:** Rule-of-thumb price bands + LLM strategies (anchoring, counter-offers, concessions) with safety rails, transparency, and audit logs.
**Data ingestion:** setup_db.py ETL from Excel/workbook + knowledge_base.docx → canonical chunks → embeddings; idempotent re-indexing.
**Observability:** Per-turn traces (prompt, retrieved chunks, price deltas), prompt cost tracking, and conversation transcripts for QA.
My contributions:
• Designed the pgvector schema and SQLAlchemy models; built the ingestion & embedding pipeline (chunking, batching, retries).
• Implemented the state-machine controller and tool interfaces (DB lookups, pricing, availability).
• Authored the negotiation policy (guardrails, discounts, max concession logic) and safe-response templates.
• Wrote the chat orchestration (chatbot.py) and REST endpoints (session init, chat, quote preview); added unit tests and manual review playbooks.