Skip to content

AI Chatbot Assistant for Business & Ecommerce

AI chatbot assistant that a business trains on its own knowledge, products and services. It answers by text or real-time voice conversation, recommends products and services, adds items to the cart, takes orders.

Role

Backend & AI systems engineer

01Overview

The problem

Businesses want a chatbot that knows their own content and can act on it: recommend the right product, add it to the cart, take the order or point a customer to the right service. A generic assistant answers from what the model remembers and can't do any of that.

Vegabot is the engine behind that kind of chatbot. A business trains it from three sources (knowledge, products and services), and it answers by text or voice, grounded in that data. When the data has no answer, it doesn't guess. It escalates to a human and records what was missing.

Who it's for

Businesses and online stores that want a chatbot trained on their own content that can also act: answer support questions, recommend products and services, fill a cart, place orders, and tell the team where their knowledge has gaps.

Features

  • Three sources of knowledge

    Knowledge comes from web URLs (crawled and scraped) and uploaded files (PDF, DOCX, XLSX). Products and services are imported from CSV or XLSX templates with a fixed structure, so a catalogue can be loaded or updated in bulk without breaking the schema.

  • Grounded answers

    Every answer is retrieved from the business's own data, not from the model's memory. Hybrid search finds candidates, a Google reranker orders them, and only the best chunks reach the agent.

  • An agent that acts

    Beyond answering, the agent recommends products and services, adds items to the cart and places orders by calling its tools, all within the conversation.

  • Human escalation

    When the knowledge base has no confident answer, the agent escalates instead of guessing. A notification shows the team the customer's question and what knowledge is missing, so the gap can be filled.

  • Text and real-time voice

    Text chat and voice both stream over WebSockets. Voice runs on Gemini Live with natural interruption, and both channels share the same agent, tools and memory.

  • Hybrid search with reranking

    Full-text search (GIN index) and semantic search (pgvector HNSW) run side by side in PostgreSQL. Their results are merged with Reciprocal Rank Fusion and then reranked by Google's ranking model.

  • Conversation memory

    Context persists for the whole conversation, so customers never repeat what they've already said, whether they typed it or spoke it.

  • Per-message metrics and caching

    Latency, tokens and cost are recorded for every message. Redis caches repeated work to keep cost and response time down.

02Architecture

Switch tabs for a different cut of the same system. Hover a component for a summary, click it for details, expand for the full page.
100%
REST · WSmessagetext · voicererankingestchunks + embeddingshybrid searchescalatecachemetricsWeb / Widgettext · voiceDjango + DRFREST · WebSocketsADK Agenttools · memoryGeminiFlash · Live · embeddingsVertex AI RankingGoogle rerankerIngestion workersCelery · PlaywrightPostgreSQLFTS + pgvectorNotificationsescalationsRediscache · sessionAnalyticsper-message metrics
Chat and voice path, agent and models, ingestion, storage and escalation.

Key concepts

  1. 01Train it from three sources.

    A business adds knowledge as web URLs (crawled and scraped with Playwright) or files (PDF, DOCX, XLSX). Products and services are imported from CSV or XLSX templates with a fixed structure, so a whole catalogue can be loaded or updated at once without breaking the schema.

  2. 02Ingestion off the request path.

    Uploads return immediately. Celery workers scrape, parse, chunk and embed each source in the background, so large files and big catalogues never block the API.

  3. 03Hybrid search, then rerank.

    Each query runs full-text search (GIN index) and semantic search (pgvector HNSW) inside PostgreSQL. The two ranked lists are merged with Reciprocal Rank Fusion, and Google's Vertex AI ranking model reorders the merged candidates by relevance. Keeping vectors next to the relational data means one store and nothing to keep in sync.

  4. 04An agent with tools, not just answers.

    One Google ADK agent decides each turn whether to answer, search the knowledge base, recommend products or services, add to cart or place an order. It remembers the conversation, so customers don't repeat themselves.

  5. 05Escalate instead of guessing.

    If retrieval finds nothing relevant enough, the agent calls its escalation tool. The team gets a notification with the customer's question and the missing knowledge, and once that content is added the bot can answer it next time.

  6. 06Two channels, one agent.

    Text runs on Gemini Flash and real-time voice on Gemini Live, both over WebSockets. They share the same agent, tools and memory, so behaviour is the same whether the customer types or talks.

  7. 07Measured per message.

    Every message records latency, tokens and cost, so the cost of each conversation is visible. Redis caches repeated work and session state to cut both cost and response time.

Tech stack

The Key componets that made it possible

  • Python
  • Django
  • Django REST Framework
  • WebSockets
  • Google ADK
  • Gemini
  • Vertex AI Ranking
  • PostgreSQL
  • pgvector
  • Reciprocal Rank Fusion
  • Redis
  • Celery
  • Playwright
  • CSV / XLSX templates
  • Docker

Next case study

AI-powered travel planning platform