CodePrism Technologies logoCodePrism Technologies
Case Study — AI & Chatbot

PrismBot RAG Implementation

A production-grade, multi-tenant AI chatbot platform enabling organizations to deploy custom, context-aware assistants across web and WhatsApp channels.

PlatformWeb (SaaS) + WhatsApp Business API
Duration3 Months
TypeAI & Chatbot
Stack10 technologies
PROJECT OVERVIEW

<300ms

Vector search latency

4x

Retrieval relevance improvement

10

Parallel embedding lookups

THE CHALLENGE

WhatsApp messaging gets complicated at scale.

Retrieval is where most chatbot deployments break, not generation. A model with a well-tuned prompt still answers wrong when the passages it receives are incomplete, off-topic, or stripped of the context that made them meaningful in the source document. Teams spend weeks tuning prompts and never touch the layer actually producing the errors. PrismBot had to work for organizations deploying assistants over their own material: support handbooks, product manuals, policy documents, internal wikis. In that setting a confidently wrong answer is worse than no answer at all. Naive top-K similarity search kept surfacing fragments severed from their headings, so the model would see a paragraph about renewal windows with no indication of which product it governed. And people phrase questions nothing like the source text: someone asks "how long do I have to send this back" against a document that says "returns must be initiated within 30 days of delivery." Single-vector lookups miss that match on vocabulary alone. Two constraints shaped everything downstream. The platform is multi-tenant, so one organization's embeddings can never surface in another organization's results. A leak here isn't a bug, it's a breach. And it ships to a web widget and a WhatsApp Business number at the same time, which rules out any design where conversation state lives in the browser session.

Challenge 1

Context loss due to naive top-K retrieval

Challenge 2

Fragmented document chunking causing incomplete responses

Challenge 3

No human fallback for failed AI interactions

Challenge 4

Disconnected systems across web and WhatsApp channels

Challenge 5

Risk of cross-tenant data leakage in shared environments

Measurable Impact
4xIncrease in retrieval relevance
300msVector search latency
100%Escalation delivery via push + email
0Cross-tenant data leakage
WHAT WE LEARNED
01

Retrieval quality moves output accuracy further than prompt tuning does

02

Cleaning and structuring documents before embedding beats tuning the retrieval that reads them

03

Agents with single responsibilities are debuggable; monolithic prompt chains are not

04

Human escalation has to be designed into the pipeline, not attached to its failure path

05

Keeping vectors in the primary database made tenant isolation one problem instead of two

Technologies Background
Our Technologies

Built with technologies we trust.

Next.js
Tailwind CSS / Material UI
NestJS
Socket.IO
PostgreSQL + pgvector
MongoDB
LangChain + LangGraph
OpenAI (GPT + embeddings)
WhatsApp Business API
Docker

Project Goals

Build a robust retrieval system that handles semantic query variations
Maintain structured and context-rich document chunking
Enable seamless human escalation with fallback mechanisms
Support multi-channel chatbot delivery (web + WhatsApp)
Ensure strict tenant-level data isolation across all layers

The Outcome

We built PrismBot as a multi-tenant SaaS platform that lets an organization upload its documents, get a trained assistant, and deploy that assistant to a website widget and a WhatsApp Business number from one admin console. Three months from kickoff to production. The build treats retrieval as the primary engineering problem rather than a solved prerequisite. Documents go through an LLM preprocessing pass before anything is embedded, so chunks carry their structural context instead of arriving as orphaned text. Incoming queries are expanded into several phrasings, searched in parallel, and reranked for diversity before a single token reaches the generation model. Vectors live in PostgreSQL with pgvector behind an HNSW index, filtered by tenant namespace at query time. Above that sits a multi-agent layer built on LangGraph. Separate agents own retrieval, context enrichment, response generation, and a grounding check that decides whether the assistant actually has the evidence to answer. When that check fails, or when someone asks for a person, the conversation moves to a human with the full transcript and the retrieved passages attached.

Conclusion & Impact

"Retrieval quality moved output accuracy further than any prompt change we made. Structured ingestion, multi-query retrieval, and MMR reranking each produced gains that held up as the corpus grew, where prompt tuning tended to fix one class of question and quietly break another. The second lesson was architectural. Splitting the pipeline into agents with single responsibilities made the system debuggable, and it made human escalation a designed path rather than something bolted onto the failure case. A retrieval system that can't recognize when it lacks the evidence to answer is a liability no matter how good its retrieval is the rest of the time."

Have a project in mind?

Let's discuss how we can help you build your next big thing.
Reach out and our team will be in touch.

Protected by reCAPTCHA. Google Privacy & Terms apply.

Building systems that hold up in production.

Bring up the problem others won't attempt.