# Retrieval testing

{% embed url="<https://youtu.be/NJAM5q0UL-A>" %}

Retrieval testing is used to identify similar chunks in response to a query, determining which data chunks will be processed by the language model. Users can submit queries related to the data stored in the knowledge base. The system then retrieves relevant chunks of information, ranking them based on how well they match the user's query. The most relevant chunk, with the highest matching score, is displayed first, followed by chunks with lower scores.

ZBrain Builder enables users to test and validate Knowledge Base retrieval performance using both **Basic** and **Agentic** retrieval methods. This allows teams to evaluate how effectively their indexed knowledge responds to real-world queries before deploying it within production agents or flows.

**Basic retrieval:** Retrieves relevant data by already matching the user’s query- ideal for quick, straightforward information needs without added complexity.

**Agentic retrieval:** Improves accuracy and delivers better results by refining the query and iteratively retrieving relevant chunks.

By comparing retrieval outputs across methods, users can assess relevance, accuracy, and contextual alignment, helping ensure that knowledge configurations are optimized prior to live execution.

1. To perform retrieval testing, navigate to the ‘Retrieval Testing’ tab. Enter a query related to your data in the provided text box, select the retrieval method and click the ‘Test’ button to execute the test.

<figure><img src="/files/2luCnsdkXGmD1yvdkwsC" alt=""><figcaption></figcaption></figure>

2. You will be provided with a retrieval result, which is an array of chunks from the knowledge base.

<figure><img src="/files/Y3GROVDQv6DcFoejcXP2" alt=""><figcaption></figcaption></figure>

3. You can find a minimum matching score for chunks to filter search results based on relevance.
4. In the History section, you can view logs of previous queries and interactions. These logs include details such as the source, text, date, and time of each interaction.

#### Monitor retrieval test queries <a href="#monitor-retrieval-test-queries" id="monitor-retrieval-test-queries"></a>

Monitoring retrieval test queries helps validate the quality and performance of your Knowledge Base under real-world conditions. By applying monitoring metrics, such as Health Check or Response Latency, you can verify that retrieved chunks are accurate, timely, and aligned with enterprise expectations before moving to production.

You can initiate monitoring directly from the History view in Knowledge Base Retrieval Testing. This reduces navigation steps and preloads query details into the monitoring module for faster validation.

To configure monitoring:

* Select a particular knowledge base and click **Retrieval Testing**
* Navigate to the **History** table
* For each test query entry in the table, you can view the Retrieval Result with a **Monitor** button in the right panel

<figure><img src="/files/KXTm9XzxKBQUoiOYrASP" alt=""><figcaption></figcaption></figure>

* Click the '**Monitor'** button next to the test query you want to evaluate.
* Go to the **Monitor module** and configure the monitoring metrics.

<figure><img src="/files/kObWQmyxNLBZySQ9VzSC" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zbrain.ai/zbrain-documentation/zbrain-builder/knowledge-base/retrieval-testing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
