Learnixo

Build PharmaBot AI · Lesson 1 of 13

Course Orientation: Architecture Blueprint & Skills Map

What You're Building

PharmaBot AI is a production-grade pharmaceutical assistant chatbot. People type questions like "Can I take ibuprofen with warfarin?" or "What are the side effects of metformin?" and get accurate, grounded, cited answers — streamed in real time.

This is not a toy. By the end of this course you will have:

  • A multi-agent pipeline (Triage → Drug Info or Interaction Checker)
  • A RAG system over 1,200 FDA drug records
  • Streaming GPT-4o responses via Azure OpenAI (Server-Sent Events)
  • A React chat UI with citation cards and interaction severity alerts
  • Security guardrails: rate limiting, prompt injection detection, PII-free sessions
  • Azure Container Apps deployment with GitHub Actions CI/CD

The 10 Skills — Mapped to Components

Every lesson in this course teaches one skill through one real component:

| Skill | What We Build | |---|---| | 1. AI Agents + Workflows | Triage Agent → Drug Info / Interaction Checker Agents (LangChain) | | 2. Practical LLM Experience | Azure OpenAI GPT-4o streaming, caching, retry | | 3. Fast Prototyping | Working chatbot in under 2 hours from git clone to first response | | 4. APIs + Backend Engineering | FastAPI async backend, Pydantic v2, full OpenAPI spec | | 5. Prompt Engineering | Safety system prompts, medical disclaimers, structured JSON output | | 6. Vector Search / RAG | Azure AI Search HNSW + pgvector hybrid over drug knowledge base | | 7. Azure / Cloud | Azure OpenAI, Azure AI Search, Azure Container Apps | | 8. Security & Privacy | Redis rate limiting, injection detection, PII-free sessions | | 9. Team Collaboration | OpenAPI-first design, module boundaries, PR conventions | | 10. Production Delivery | GitHub Actions CI/CD, structlog, health checks, Azure Monitor |


System Architecture

User (Browser)
    │
    ▼
React Chat UI  ──── Server-Sent Events ────►  FastAPI Backend (port 8000)
                                                      │
                              ┌───────────────────────┤
                              │                       │
                     Triage Agent (LangChain)         │
                    /                \                │
           Drug Info Agent    Interaction Checker      │
                    \                /                │
                     ── RAG Pipeline ──               │
                          │       │                   │
               Azure AI Search   pgvector             │
               (HNSW vector)    (fallback)            │
                                                      │
                         Azure OpenAI (GPT-4o)        │
                         Redis (rate limit + session)  │
                         PostgreSQL (metadata)         │

Repository Structure

PharmaBot-AI/
├── pharmabot/
│   ├── agents/         # Triage, Drug Info, Interaction Checker
│   ├── rag/            # Embedder, Retriever, Chunker, Pipeline
│   ├── prompts/        # System prompts, disclaimers, templates
│   ├── api/            # FastAPI routes (chat, search, health)
│   ├── security/       # Rate limiter, sanitizer
│   └── main.py
├── frontend/           # React 19 + TypeScript streaming UI
├── scripts/            # seed_knowledge_base.py
├── data/               # drugs.jsonl (1,200 FDA records)
└── tests/

Prerequisites

Before starting, confirm you have:

  • Python 3.11+ installed — python --version
  • Node.js 18+ installed — node --version
  • Docker Desktop running — docker ps
  • Azure subscription with Azure OpenAI approved (takes 1–2 business days if new)
  • Git installed

If you're missing Azure OpenAI approval, you can still complete lessons 1–8 using the mock Azure client included in the repo (MOCK_AZURE=true in .env).


How to Use This Course

Each lesson:

  1. Explains the concept — what it is and why it matters
  2. Shows the code — real implementation, not pseudocode
  3. Points to the exact file — so you can open it and read it
  4. Ends with a checkpoint — a curl command or test you run to verify it works

Work in order. Each lesson builds on the previous one. If something doesn't work, check the troubleshooting/ folder in the repo — common errors and fixes are documented there.

Let's build.