Rishav Raj

Ask, an enterprise chatbot that answers from a team's own documents

A RAG chatbot for Flexday's enterprise clients. A team uploads its documents and Ask answers questions from them, with access control so each department only sees its own files.

Where
Flexday AI, Feb 2024 to Feb 2025
Used by
Several teams at JLL, including HR for policy questions. The HR app had about 30K users and 500 concurrent at the US daytime peak.
I built
The React app, the answering flow, and the access control service

Worked on


The UI

I built the front end as a React single page app. This was early 2024, when AI coding tools were far weaker than they are now, so it was written by hand. It uses Material UI and shadcn/ui, themed to Flexday's design.

There are two main screens. The chat is where people ask questions. The admin page is where an HR admin sees every document the chatbot can answer from, and can upload, delete and manage them. Showing that list matters in practice: it is how an admin knows what Ask can and cannot answer, and removing a file removes it from the answers.

Getting documents in

Files are PDF and DOCX, and an admin can also connect a database as a source. A teammate built the parsing service: it extracts the text from a PDF, runs OCR, and describes what is in the file. I built the upload, delete and manage screens around it.

UploadPDF or DOCXParsertext, OCR, imagesChunksada-002embeddingsElasticsearchA database can also be connected as a source
A teammate built the parser as a service. I built the upload and admin UI around it.

Documents are chunked and embedded with ada-002, and stored in Elasticsearch.

The answering flow

Models of that period had no reasoning mode and were far weaker at following long instructions, so I built the flow as a series of small steps instead of one model doing everything. A guardrail model checks the question first. A scope check decides whether Ask should answer it at all. Then the question is rewritten so it retrieves better.

The rewritten query is embedded with the same ada-002 model as the documents and searched in Elasticsearch, which returns the top k results. Those are re-ranked with ColBERT, and the top 5 go to GPT-4o as context to write the answer.

QuestionGuardrailsmall modelScopein scope?Rewritefor retrievalEmbedada-002SearchElasticsearch top kRe-rankColBERTTop 5as contextAnswerGPT-4o
Models of that period had no reasoning mode, so the steps are separate calls instead of one model thinking.

Re-ranking is there because the first search is fast but rough. A vector search finds things that are near the question, and the re-ranker decides which of them actually answer it, so the model sees five good passages instead of twenty near ones.

Access control

Ask was deployed across several departments of a large company. One department must not read another's files, and within a team not everyone should read every document. So the permissions had to be granular: which page a user can open, and which documents they can read or change.

I built a role based access control service modelled on AWS IAM, with policies, roles, user groups and permissions. We built it ourselves and did not use AWS IAM because clients ran on AWS, Azure and GCP, and Ask was deployed into their own environments. The full design is in the RBAC write up.

Usermember of one or more tenantsRole or groupset on the membershipPolicylike an IAM policyPermissionresource:actionChecked on every page and every documentChat page, admin page, read a file, change a file, so one department never sees another's files
The same permission strings build roles and also scope service to service callers. The full design is in the RBAC write up.

Deployment

Ask was deployed into each client's own environment, where the data stays on their network. Reaching it meant working through their virtual networks and on their hardware. I developed and shipped it to Flexday's side, and a hosted team took over the on premise environments from there. The Tropicana chatbot followed the same path, including their security review, firewall rules and VPN setup.


Back to home · Evernorth chatbot · Flexday RBAC