Case Study · Conversational AI
How a support chatbot went from keyword rules to LLM intent detection and RAG
Our client runs a customer support chatbot product for travel, food and beverage, and financial services businesses. AMT rebuilt its brain in two steps: OpenAI-powered intent detection so it understands how people actually talk, then retrieval augmented generation so its answers come from the client's own documents.
Schedule Technical DiscoveryYour first conversation will be with a senior technical partner, not a salesperson.
Published
At a glance
- Client
- Provider of an automated customer support chatbot product
- Industries served
- Travel and transportation, restaurants and food and beverage, financial services
- What AMT built
- OpenAI API intent detection, then a RAG pipeline with LangChain and a vector database
- Models
- GPT-4o, Gemma 2, Llama 3.1
- Stack
- Angular, NestJS, Python (FastAPI), MongoDB, Chroma DB
- Result
- Higher intent recognition accuracy, more accurate and context-aware answers, less manual intent training
The short version
Rule-based chatbots break the moment a customer phrases something differently from the training examples. AMT replaced keyword matching with an OpenAI-powered NLP engine that finds the closest intent even when the wording is new. Then AMT added retrieval augmented generation: documents become vectors in Chroma DB, each question retrieves the most relevant passages, and the language model answers from those passages instead of guessing.
The problem
The chatbot started life as a rule-based system. That design has limits every support team recognises:
- It struggles with complex or conversational questions.
- It fails when users phrase the same request in a new way.
- Every new phrasing means more manual intent training.
- It has little sense of context, so answers come out incomplete or wrong.
Because the product serves three industries, those failures multiplied. The client needed the bot to understand natural language properly and to answer from real, current information.
Step 1: LLM intent detection with the OpenAI API
AMT integrated the OpenAI API as the chatbot's NLP engine. The bot still uses intent-based conversation design, because intents keep a support bot predictable. What changed is how intents are matched.
Each intent holds three things:
- Training phrases, which are examples of what users type
- Expected response patterns
- Context information
Example intents include booking inquiries, order status requests, payment and billing questions, reservation management and general support. The language model matches a user's message to the closest intent even when it looks nothing like the stored examples. That one change cut the manual work of adding phrasings and made the bot far better at messy, real-world input.
Step 2: Retrieval augmented generation
Intent detection fixes understanding. RAG fixes answers. AMT built the pipeline like this:
- Embed the knowledge. Documents, articles and other text are converted into vectors using transformer-based embedding models such as Sentence-Transformers or OpenAI embeddings.
- Store and index. The vectors and their document index live in Chroma DB.
- Embed the question. Each user query is converted into a vector with the same technique.
- Find the closest passages. Similarity metrics such as cosine similarity and Euclidean distance rank stored documents against the query.
- Retrieve the top results. The highest-ranked passages become the context for the answer.
- Generate a grounded answer. The language model combines the retrieved context with the question and writes the response.
LangChain connects the language models to the client's data sources and tools, and lets the system take in industry-specific datasets as they change. The pipeline works with GPT-4o, Gemma 2 and Llama 3.1.
Results
- Higher intent recognition accuracy
- Better conversation quality on complex and natural questions
- Accurate, contextually relevant answers drawn from the client's own content
- Less manual effort maintaining intent datasets
- Better customer engagement and satisfaction
Technology stack
| Layer | Technology |
|---|---|
| Front end | HTML, CSS, Angular |
| Back end | NestJS, Python (FastAPI) |
| Databases | MongoDB, Chroma DB (vector database) |
| Orchestration | LangChain |
| Language models | OpenAI API, GPT-4o, Gemma 2, Llama 3.1 |
Before you build something similar
- Is your problem understanding or answering? If the bot misreads questions, start with intent detection. If it reads them fine but answers badly, you need retrieval.
- Is your content ready to retrieve? RAG is only as good as the documents behind it. Out-of-date or duplicated content produces confident wrong answers.
- Do you need more than one model? Supporting open models like Gemma 2 and Llama 3.1 alongside GPT-4o gives you options on cost and data location.
- How will you test it? Build a set of real customer questions with known good answers before launch, and rerun it after every change.