Skip to content

Improving the generated answers

A RAG bot is never finished on the first try: documents evolve, users ask unexpected questions, and a change of model or prompt can improve some answers and degrade others. This page describes the improvement loop, and the Tock Studio tools used at each step.

flowchart LR
    O[Observe<br/>real conversations] --> D[Diagnose<br/>a wrong answer]
    D --> F[Fix<br/>documents, settings, prompt, stories]
    F --> M[Measure<br/>replay a dataset]
    M --> O

1. Observe

  • The Dashboard summarizes the RAG activity: share of the answers grounded in the retrieved documents, topics answered, state of the knowledge base, checks of the Gen AI configuration.
  • Analytics > Dialogs shows the conversations, with the RAG answer and its sources. They can be filtered on the RAG answer status, for example to list the questions answered without relevant documents. Enable Dialogs debug in the RAG settings to also record the condensed question and the documents retrieved.
  • The RAG answer status, the topic and the suggested topics returned by the LLM are also recorded as indicators (RAG Status, RAG Topics, RAG Suggested Topics), available in the Metrics menu.
  • With an observability provider such as Langfuse, each answer links to the trace of its LLM calls: exact prompts, documents, token usage and latency.
  • Evaluations let business experts review and grade a sample of real conversations.

2. Diagnose

From a bot answer in Analytics > Dialogs, shortcuts open the question in the retrieval diagnostic or in the playground, with the values recorded for this exchange. First find out where the chain went wrong:

Symptom Likely cause Tool
The right document is not among the sources Retrieval: the document is missing from the index, badly chunked, or ranked too low Retrieval diagnostic, vector store exploration
The right document is among the sources, but the answer is wrong or incomplete Generation: prompt, model or context size Playground, observability traces
The bot answered a question it should not have Scope: topic not excluded, or a validated answer is missing RAG exclusions, prompt context, FAQ
A question was answered by the wrong story NLU: the sentence was classified in an intent that has a story Language understanding, model quality

3. Fix

Depending on the cause:

4. Measure

Before deploying a change, check that it does not degrade other answers:

  1. Build a dataset of representative questions, including those that were answered badly.
  2. Run it before and after the change, and compare the runs.
  3. If needed, create an evaluation sample from a run so that business experts grade the new answers.

The Dashboard history keeps track of the changes of the Gen AI settings and of the corpus, to relate a change in the metrics to a change in the configuration.

Chat with Tock
×