cogni.build

RAG chatbot example

The same question.
Different access.
Different evidence.

A retrieval-augmented assistant uses retrieved material as context for an answer. Before judging the answer, inspect which material the user was allowed to retrieve.

Our interactive labs let you explore that decision with a fictional newsroom. They run in your browser using synthetic documents and preset relevance scores. They do not call a language model or a live vector database.

Try the funding-formula question.

In the retrieval lab, select the levy funding-formula question. Compare Alice on the metro desk with Dana on the legal desk.

A legal memo is eligible for Dana and excluded for Alice. That difference is about access, not how convincingly an assistant could write an answer.

  1. Compare the source sets

    Review the eligible documents for each persona before looking at the final source handles.

  2. Move the filter

    Compare “Inside the query” with “As a post-filter.” Observe how filtering a limited result set can remove useful evidence after selection.

  3. Change the person and question

    Try the contractor and the indictment question. The embargoed legal draft should not become an allowed source.

What this example actually demonstrates.

Executable selection logic

The browser applies desk, clearance and publication-status rules to a fixed corpus. Ranking and filtering are calculated from preset example scores, rather than measured search relevance.

A visible explanation

The lab displays the pipeline and source choices so you can discuss where a real application's access checks belong.

Limits of the browser lab

All example data is shipped to the browser and is intentionally public. The role selector is an educational control, not authentication or protection for private data.

Work needed for production

A real system must derive identity from a trusted session, enforce tenant and document access on the server, retrieve current evidence, and evaluate generated answers. This lab does not implement those services.

Evaluate the retrieval before the prose.

Write down the question, user context, required sources, forbidden sources and expected outcome. Run the same cases after changing retrieval settings or permissions.

We checked the lab's returned documents across all five questions, four personas, two filtering modes and four result limits. The returned documents satisfied the lab's visibility rule in those 160 combinations. Separate checks cover the legal memo, embargoed content and a clearance change. These are deterministic synthetic checks, not a model-quality benchmark or a security assessment.

The evaluation lab also uses synthetic scoring. For a real assistant, collect actual outputs and assess retrieval quality, answer support, failures, latency and cost. A passing simulated gate is not a production release decision.

Questions to bring to your implementation.

Does the example test tenant isolation?

No. Its personas have document-access rules within a fictional organization. Separate customer tenants need their own enforced boundaries and tests. The downloadable starter includes that as additional production work.

Does post-filtering always leak data?

No. The effect depends on what is retrieved, where filtering happens and what is exposed. This lab deliberately makes intermediate stages visible for teaching. A production design must prevent restricted evidence from reaching an unauthorized caller or model context, and evaluate retrieval quality as well as access enforcement.

What happens when permissions change?

The next query must use the current authorization policy. Our local check changes the synthetic persona's clearance and verifies the legal memo is excluded. A production test must also cover caches, tokens, authorization failures and requests already in progress.

Where does generation fit?

Generation follows authorized retrieval. An assistant should answer from appropriate evidence, cite it where useful, and handle missing context. This browser lab stops at evidence selection; it does not measure answer accuracy or hallucination rates.

References for the production work.

Pinecone's access-control tutorial illustrates authorization and revocation. Microsoft's multitenant RAG guidance addresses tenant architecture. LangChain's evaluation tutorial provides a workflow for datasets and evaluation. Review the current guidance against your architecture.

Apply the questions to your product.

Bring one workflow, the sources it needs and the access boundaries it must respect. We can use those to discuss a useful first scope.

Discuss your workflow