Building and Optimizing a RAG-based Customer Service Chatbot

hdi · Insurance · 2022 · source Agentic: no · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Insurance

HDI needed a production RAG chatbot to help customer service agents answer insurance questions across complex internal document sources.

Constraints:

Architecture

HDI's customer-service chatbot is a modular RAG system for insurance agents, built around ingestion from SharePoints/databases, OpenSearch vector storage, specialized chunking, hybrid search, custom reciprocal-rank fusion, reranking, a chat interface, and feedback-driven experimentation. The team optimized chunking, embeddings, HNSW/vector indexing, and retrieval parameters through roughly 100-120 experiments before and after MVP.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  enterprise-document-sources["enterprise-document-sources"]
  ingestion-and-chunking-pipeline["ingestion-and-chunking-pipeline"]
  opensearch-vector-store["opensearch-vector-store"]
  hybrid-search-retriever["hybrid-search-retriever"]
  reranking-layer["reranking-layer"]
  chat-answer-interface["chat-answer-interface"]
  feedback-loop["feedback-loop"]
  experiment-harness["experiment-harness"]
  enterprise-document-sources --> ingestion-and-chunking-pipeline
  ingestion-and-chunking-pipeline --> opensearch-vector-store
  ingestion-and-chunking-pipeline --> experiment-harness
  opensearch-vector-store --> hybrid-search-retriever
  hybrid-search-retriever --> reranking-layer
  hybrid-search-retriever --> chat-answer-interface
  reranking-layer --> chat-answer-interface
  chat-answer-interface --> feedback-loop
  feedback-loop --> experiment-harness
  experiment-harness --> ingestion-and-chunking-pipeline
  experiment-harness --> opensearch-vector-store
  experiment-harness --> hybrid-search-retriever
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
enterprise-document-sources SharePoint and database sources containing insurance answers and policy content ingestion-and-chunking-pipeline
ingestion-and-chunking-pipeline parses documents, handles layout/table issues, and creates chunks for retrieval opensearch-vector-store, experiment-harness
opensearch-vector-store stores text chunks and embeddings for vector retrieval hybrid-search-retriever
hybrid-search-retriever combines vector and lexical retrieval with custom reciprocal rank fusion reranking-layer, chat-answer-interface
reranking-layer reranks overfetched retrieval results before answer generation chat-answer-interface
chat-answer-interface lets customer-service agents ask natural-language insurance questions feedback-loop
feedback-loop collects positive/negative feedback and comments for ongoing optimization experiment-harness
experiment-harness runs experiments over chunking, embeddings, HNSW/index parameters, and retrieval settings ingestion-and-chunking-pipeline, opensearch-vector-store, hybrid-search-retriever

Data flow

Insurance documents from SharePoints and databases are ingested into a knowledge base, chunked according to document/layout choices, embedded into a vector store, retrieved through OpenSearch plus custom hybrid search/reranking, and surfaced through a chat UI for customer agents. Positive/negative feedback and text comments feed back into experiments over chunking, indexing, embeddings, and retrieval settings.

3 supporting quotes
“you still have to go through couple of sharepoints databases to answer your question what The idea was to bring all of that into one knowledge base”transcript, implied
“it's a typical rack as you can see you have an ingesting part you have the rag flow that takes in account some feedback loop”transcript, stated
“one thing that definitely we did from the start is doing hybrid search”transcript, stated

Why this architecture

The architecture follows the operational need: insurance agents needed fast answers buried in long documents, but retrieval quality depended heavily on use-case-specific chunking, embedding choices, index settings, and hybrid retrieval. A modular RAG design let HDI swap model/endpoints, tune retrieval experimentally, and keep improving from production feedback rather than treating RAG as a one-shot build.

3 supporting quotes
“some documents are over 100 pages long.”transcript, stated
“it is created just in a modular form just like some Tetris or Lego. So you can just pick and choose some pieces.”transcript, stated
“a lot of this is dependent on what you need and what your use case”transcript, stated

Scale

Alternatives considered (roads not taken)

Manual search across SharePoints and databases

Rejected because: Customer agents had to search multiple stores and scroll long documents to answer questions quickly.

“you still have to go through couple of sharepoints databases to answer your question”transcript, stated

Rigid one-provider RAG stack

Rejected because: The architecture was designed as modular Lego/Tetris blocks so teams could swap Bedrock, OpenAI, or SageMaker endpoints.

“you don't want to use bedrock, you don't want to use open eye, put your SageMaker endpoint in there and then just be done with that.”transcript, stated

Vector-only retrieval

Rejected because: The team implemented custom hybrid search and reciprocal-rank-style fusion because hybrid support was not available or sufficient at the time.

“hybrid search I'm not sure it was not supported so we did do a custom hybrid search or and then a custom RF on top”transcript, stated

Pick chunk sizes by intuition

Rejected because: The transcript repeatedly frames chunking and retrieval settings as use-case-specific empirical choices.

“how do you decide what chunk size to choose?”transcript, stated
“it is a lot of experimentation that has to go in to understand what works the best for your use case.”transcript, stated

Patterns

rag-retrieval (retrieval)

The chatbot uses a RAG retrieval layer over insurance documents to support customer-service answers.

“So, we need we need to ensure that you know the retrieval is super fast, very efficient and also does not cost much, right?”transcript, stated

hybrid-search (retrieval)

HDI implemented custom hybrid search when native OpenSearch support was not sufficient at the time.

“hybrid search I'm not sure it was not supported so we did do a custom hybrid”transcript, stated

eval-driven-development (evaluation)

The team ran about 120 experiments and used recall to decide when to move into an MVP with test users.

“We did round about 100 experiments before”transcript, stated

Tradeoffs

Move to MVP after clearing an 85% recall target instead of continuing offline tuning indefinitely.

Chose test-user MVP with feedback over predicting all usage through more experiments.

Rationale: The transcript says the team moved above 85% recall to test users and actual feedback.

“we were like okay if we go above 85% recall rate let's just move into MVP and put the test users in there so they can test that and then we get the actual feedback”transcript, stated

Gotchas (what bit them)

RAG tuning can become an endless search over chunking, algorithms, and parameters.

Root cause: There are many combinations of chunking strategies and indexing parameters.

Resolution: HDI prioritized what mattered for the use case and moved to MVP once recall cleared a target threshold.

“at some point you do have to move from this idea that you will experiment otherwise you will be in this this loop all the time”transcript, stated

Evaluation

The team measured recall, query latency, and user feedback, then continued incremental experiments after launch.

Metrics: 88% recall · 6ms query latency · positive/negative feedback

“we optimize the index we are getting like around 88% recall rate and we do have a function of feedback.”transcript, stated

Outcomes

The deployment was expected to expand to around 1,200 users.

“we have around 800 users that are actually using that.”transcript, stated