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

# Test your knowledge base

> Build a knowledge corpus from your documents or database so the suite tests the answers your agent retrieves.

If your agent answers from a knowledge base, through a RAG or text-to-SQL tool or knowledge inlined in its prompt, the suite needs a knowledge corpus to test it. The corpus is built from your own data and becomes the ground truth that retrieval scenarios and evals check your agent's answers against. Without it, the suite contains no retrieval scenarios.

## Build the corpus

Usually you don't run anything. When your agent has a knowledge source and no corpus exists, `/simulation-generate-suite` asks whether to build one and builds it as part of the suite. You can also build it on its own, after the scan:

```bash theme={null}
/build-rag-corpus
```

Or say it in chat: "Build a knowledge corpus from `docs/help-center/`."

A purely transactional agent with no knowledge source doesn't need a corpus, and the plugin tells you so.

## Supported sources

| Source | Examples |
| - | - |
| Local documents | A directory of files, including compressed archives. Markdown is split by section. |
| Local data | SQLite, JSON records |
| Data warehouses | BigQuery, Snowflake, Redshift, Azure SQL, Databricks |
| Search and vector indexes | Azure AI Search, Vertex AI Search, Bedrock Knowledge Bases, LangChain and LlamaIndex vector stores |

Databases and indexes need the SDK's matching extraction extra, for example `plurai-simulation-sdk[extract-bigquery]`. The plugin installs the extras a build needs, after asking. You don't need an LLM key. See [Install the SDK](https://docs.plurai.ai/sdk/install.md#extras).

## What happens

**1. You choose what to include**

If your agent has several knowledge tools, the plugin asks which to build. For a large source it asks whether to use the whole source or a focused subset; a subset is recommended to start. If a corpus already exists, it asks whether to reuse it.

**2. Your data is extracted locally**

The SDK reads your source on your machine and extracts chunks and the links between them into `plurai_sim/rag_corpus/`. Connection details are kept in a temporary file that is deleted afterwards. Credentials never leave your machine.

**3. The chunks are uploaded**

Only the extracted chunks and their relationships are uploaded, as one archive. If this is your first upload, the plugin asks whether to anonymize first.

**4. The backend builds the corpus**

The Plurai backend builds a knowledge graph and a set of test questions from the chunks, and keeps them as ground truth. They are not written to your machine.

Each knowledge tool gets its own corpus: a personal-memory RAG and a company-docs RAG are separate knowledge bases, never merged.

## What you get

When you build it on its own, the plugin reports that the corpus is delivered, and your next `/simulation-generate-suite` records it and builds the retrieval scenarios and evals from it. The suite writes the corpus references into `plurai_sim/`:

| File | What it is |
| - | - |
| `.knowledge_bases` | Each knowledge tool, its label and its corpus IDs. |
| `.corpus_id` | The corpus ID, when your agent has a single knowledge base. |
| `rag_corpus/` | The locally extracted chunks. Gitignored. |

The `.knowledge_bases` and `.corpus_id` files are committed. The build can also correct your agent specification where it disagrees with your documents.

If the build comes back thin because your documents are too short or too flat, the plugin suggests rebuilding with a smaller chunk size. Rebuilding replaces the old corpus, so the plugin asks you to confirm. To remove a corpus, ask in chat: "delete this corpus."

## What gets uploaded

Only the extracted chunks and relationships leave your machine, never your credentials or the full source. Every upload is recorded in `.plurai/uploads/audit.log`. See [Data and privacy](https://docs.plurai.ai/security/data-and-privacy.md).

## Next steps

> [card] [Build the suite](https://docs.plurai.ai/guides/build-the-suite.md)
>
> Generate retrieval scenarios and evals from the corpus.

> [card] [Shape your simulation](https://docs.plurai.ai/guides/iterate.md)
>
> Fix a wrong fact or a bad question in the corpus.

> [card] [Real records](https://docs.plurai.ai/guides/real-records.md)
>
> Ground scenarios in specific records instead.

> [card] [Data and privacy](https://docs.plurai.ai/security/data-and-privacy.md)
>
> Anonymization, retention and deletion.


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