> ## Documentation Index
> Fetch the complete documentation index at: https://docs-eos.fpt.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieval test

> See exactly what an agent receives before it answers - The first debugging tool when an agent answers wrongly.

Wrong answers usually come from the agent receiving the wrong passages, not from the model. **Retrieval test** runs the exact question through the exact KB with the same configuration the agent uses, then shows you each returned chunk with its score and an automatic diagnosis.

## Screen layout

| Area | Content |
| - | - |
| Query configuration (left) | KB, method, filters, Top-K, score threshold |
| Question box and **Retrieve** button | Enter the question to check |
| Retrieved chunks (center) | Results in ranked order |
| Diagnosis (right) | The platform's automatic analysis of the retrieval |

## Configuration parameters

| Parameter | Meaning |
| - | - |
| Knowledge base | The KB to test |
| Query method | Vector, BM25 or *Hybrid Search + Rerank (70% Vector)* |
| Metadata filter | Several conditions separated by `;`, with operators `=`, `!=` or `~` (contains). Example: `phong_ban = HR;ten_tep~Quy_che` |
| Top-K | Number of chunks returned (default 6) |
| Similarity threshold | Chunks below the threshold are dropped (default 0.35) |

## Reading the results

Each returned chunk shows its **rank**, **passage title**, **score** (e.g. 0.51), **document name**, passage content and **chunk ID**. The first line of the results says how many results came from how many candidates.

The **Diagnosis** block:

| Metric | How to read it |
| - | - |
| Candidates | How many chunks were found before cutting down to Top-K |
| Top score | Score of the first-ranked chunk |
| Gap #1–#2 | Score difference between the top two chunks - Large means the result is *Clear*; small means the agent can easily pick the wrong one |
| Distinct sources | How many documents the results came from |
| Filtered by validity | Chunks dropped because the document is no longer in effect |

Click **Add to golden question set** to save this question to the test set in [Quality evaluation](https://docs-eos.fpt.ai/en/screens/evaluation.md).

## Debugging wrong results

**1. No chunks returned**

Lower the score threshold, check that the documents are *Processed*, and check whether the metadata filter is too strict.

**2. Correct chunk ranked low**

Switch to *Hybrid + rerank*, or increase the BM25 weight if the question contains document numbers or codes.

**3. Chunk cut off midway**

Turn on **Expand to parent chunk** in the KB's Settings tab, or edit the chunk manually in the chunk viewer.

**4. Outdated documents returned**

Turn on **Only return documents in effect** and fill in the effective date field for the documents.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.