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 Discovery

    Your 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:

    1. Training phrases, which are examples of what users type
    2. Expected response patterns
    3. 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:

    1. Embed the knowledge. Documents, articles and other text are converted into vectors using transformer-based embedding models such as Sentence-Transformers or OpenAI embeddings.
    2. Store and index. The vectors and their document index live in Chroma DB.
    3. Embed the question. Each user query is converted into a vector with the same technique.
    4. Find the closest passages. Similarity metrics such as cosine similarity and Euclidean distance rank stored documents against the query.
    5. Retrieve the top results. The highest-ranked passages become the context for the answer.
    6. 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

    Technology stack
    LayerTechnology
    Front endHTML, CSS, Angular
    Back endNestJS, Python (FastAPI)
    DatabasesMongoDB, Chroma DB (vector database)
    OrchestrationLangChain
    Language modelsOpenAI API, GPT-4o, Gemma 2, Llama 3.1

    Before you build something similar

    1. 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.
    2. 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.
    3. 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.
    4. How will you test it? Build a set of real customer questions with known good answers before launch, and rerun it after every change.

    FAQ

    What is a RAG chatbot?

    A chatbot that retrieves relevant passages from your own documents before it answers, then has the language model write a response based on those passages. It gives more accurate answers than a model working from its training data alone.

    Do you still need intents if you use an LLM?

    For customer support, usually yes. In this project intents kept the bot predictable, and the LLM made intent matching work on phrasings it had never seen.

    Which vector database did AMT use?

    Chroma DB, alongside MongoDB for application data.

    Can RAG work with open source models?

    Yes. This pipeline runs with Gemma 2 and Llama 3.1 as well as GPT-4o.

    Tell us what your chatbot gets wrong today and where your answers live.

    See how AMT builds RAG systems →