IK Imran Khalid

AI Agents & Automation 4 months Swift Sales / iAXON Deployed

Swift Sales

24/7 NLP Automation for Pharmaceutical Distribution

Swift Sales project cover

Overview

End-to-end ML and NLP automation system that reads natural-language product, pricing and stock questions from the company website and WhatsApp, classifies intent, and answers instantly without a human in the loop.

The problem

Pharmaceutical distributors handle hundreds of repetitive daily inquiries about availability, pricing and order status. Staff spend hours answering the same questions on WhatsApp, replies are slow, and manual order capture introduces pricing and stock errors.

The solution

Built an intent-classification and entity-extraction service over the product catalog. Incoming messages are normalized, classified into order, stock, price, or support intents, resolved against live inventory and pricing data, and answered in the same channel. Unclear or high-value conversations escalate to a human with full context.

Project gallery

Technical architecture

Channel adapters, NLP intent layer, and catalog-backed answer service

Channel Adapters

Normalize incoming messages from the website chat widget and WhatsApp Business into a single internal message format.

Intent & Entity Classifier

Detects the customer goal and extracts product names, quantities and order references from free-text, including roman-Urdu phrasing.

Catalog & Stock Resolver

Queries live product, batch, price and stock tables so answers reflect the current inventory instead of a stale document.

Escalation Router

Hands low-confidence or commercial conversations to a human agent with the transcript, extracted entities and suggested reply attached.

Methodology

  1. Collected real inquiry transcripts and labelled them by intent and product entity
  2. Trained and compared classical and transformer-based intent classifiers on the labelled set
  3. Built a fuzzy product matcher tolerant of spelling variants and brand abbreviations
  4. Added confidence thresholds so uncertain queries escalate instead of inventing an answer
  5. Instrumented every conversation for intent accuracy and containment rate review

Results & impact

78% Automated Replies Of routine inquiries handled without staff
94% Intent Accuracy On the labelled evaluation set
<5s Response Time Median reply across both channels

Key impact

  • Freed sales staff from repetitive catalog questions
  • Cut pricing and stock errors caused by manual copy-paste replies
  • Kept WhatsApp as the primary channel without adding headcount
  • Produced a searchable log of customer demand for purchasing decisions

Challenges & solutions

Roman-Urdu and Mixed-Language Messages

Augmented training data with transliterated variants and added normalization for common spelling patterns

Product Name Ambiguity

Combined fuzzy string matching with brand and strength fields so similar products resolve correctly or ask a clarifying question

Key implementation

Intent Routing with Escalation

def handle_message(message):
    """Resolve a customer message or escalate it with context."""
    intent, confidence = classifier.predict(message.text)

    if confidence < 0.65:
        return escalate(message, reason="low_confidence", intent=intent)

    if intent == "stock_query":
        products = catalog.match(message.text)
        if not products:
            return ask_clarification(message)
        return stock_reply(products, message.channel)

    if intent == "price_query":
        return price_reply(catalog.match(message.text), message.channel)

    return escalate(message, reason="requires_human", intent=intent)

Technologies used

PythonNode.jsNLPIntent ClassificationEntity ExtractionWhatsApp IntegrationFastAPIPostgreSQL