Part F · Chapter 33 · The platform on Azure, streaming and AI

33. Data for generative AI

An AI assistant answers from documents it retrieves at the moment of the question. Parse and chunk each document the way its type needs, carry its classification and readers onto every chunk, filter by the asker before ranking, delete by document, and cite every chunk the answer used.

Documents chunked, embedded and retrieved with their access rights
Playback speed

The clip indexes Harbour Mutual's seven documents: each is parsed into sections and cut into chunks the way its type needs, and every chunk is embedded and stored with the document's classification and readers. The analyst then asks what injuries were treated on claim CL-2025-00107. Every chunk is scored against the question; the medical report's chunks score highest, but the analyst may not read special-category documents, so they are withheld before ranking. The answer is drawn only from chunks the analyst may read, and is linked back to the chunks it cites.

The idea: retrieve, then generate

A language model knows nothing about Harbour Mutual's claims. Retrieval-augmented generation (RAG) gives it the right paragraphs at the moment of the question: the documents are prepared once, then each question retrieves the best chunks and the model writes its answer from them, citing them.

  • Parse: turn each file into text with its structure: headings, sections, tables.
  • Chunk: cut the text into pieces small enough to cite and to fit the model's input, in a way that suits the document type: a policy wording by section, a claim note whole, a long report in windows that overlap.
  • Embed: turn each chunk into an embedding, a list of numbers that places texts with similar meaning close together, so "burst pipe" finds "escape of water". This lab ranks with BM25, a keyword score, so every answer here can be checked by hand; production indexes usually combine both (hybrid search).
  • Retrieve and answer: score every chunk against the question, keep the best few, and give them to the model with an instruction to answer only from them and cite each one.
Access rights travel with every chunk A chunk is a copy of part of a document. Unless the document's classification and its readers are copied onto every chunk, the access rules stay behind on the original. Filter on them before ranking, so a chunk the asker may not read never takes a place in the results.
Remember Every chunk carries its document's id, classification and readers: filter by the asker before ranking, delete by document id, and cite the chunks the answer used.

A worked example: the analyst asks about an injury

Chunked with the defaults, the seven documents make 17 chunks. The analyst asks "What injuries were treated on claim CL-2025-00107?": 3 chunks are used and 1 are withheld, because the medical report is special category and only the claims handler may read it. The claims handler, asking the same question, gets an answer from doc-medical-00107#1.

The analyst's candidates, best first (computed by the Retrieval workbench)
RankChunkClassificationScoreOutcome
1doc-medical-00107#1special category6.03withheld before ranking
2doc-board-q3#1confidential4.11used, and cited
3doc-claims-guideline#4internal1.15used, and cited
4doc-faq#3public1.15used, and cited
Try this In the Retrieval workbench, set the access filter to none: the medical report reaches the analyst's answer, marked as a leak.

Why it matters for Alex

The board wants the claims assistant live, and the first question from the data protection officer will be "can it show a medical note to the wrong person?" Alex's answer cannot be a promise about the model; it has to be a property of the data: every chunk carries its readers, the filter runs before ranking, a deleted document leaves no chunk behind, and every answer cites where it came from, so a wrong answer can be traced to its source.

The EU AI Act behind this chapter An assistant that customers talk to brings duties under the EU AI Act whatever its risk class. The rules below are summarised, not quoted; check each against its source with your legal team before you rely on it, and this is not legal advice.
What the EU AI Act asks, summarised, and where it is written
ObligationIn shortWhere it is written
Tell people they are talking to an AIA system that interacts directly with people is designed so that they are told they are interacting with an AI system, unless that is obvious to a reasonably well-informed person; this applies from 2 August 2026.EU AI Act, Article 50(1); date in Article 113
Provider or deployerAn organisation that develops an AI system and puts it into service under its own name, including for its own use, is its provider; an organisation that uses an AI system under its authority is a deployer. Building your own assistant can make you both.EU AI Act, Article 3, points (3), (4) and (11)

Where it goes wrong

  • Access checked on the document, not the chunk. The index holds copies; the rules stayed on the originals.
  • Filtering after ranking. Forbidden chunks take the top places and are removed afterwards: the asker gets fewer, worse answers, or none.
  • One chunking for everything. Fixed windows across a policy wording mix two sections in one chunk, and the answer cites the wrong clause.
  • Deleted at the source, alive in the index. The file is gone; its chunks still answer questions.
  • Answers without citations. Nobody can tell whether the assistant read the 2025 wording or made it up.

Exercises

The lab checks each one against facts written down in advance, so any answer the brief allows passes. A pass is kept in this browser.

Chunk each document type

Choose how each type of Harbour Mutual's documents should be chunked, so that every chunk can be cited on its own and carries the metadata its type needs.

Policy wording
Handling guideline
Claim note
Medical report
Board pack
Customer FAQ

Access rights for every role

Harbour Mutual's assistant goes live for four roles. Every role asks every one of the workbench's five questions: no chunk may ever reach a role that may not read it, no role may lose an answer it is allowed to see, each answer may draw on up to three chunks so it can cite more than one source, chunks stay small enough to cite precisely (at most 80 words), and consecutive chunks overlap so a sentence cut at a boundary stays whole in one of them.

The lab checks that:

  • Access is filtered before ranking.
  • No chunk reaches a role that may not read it, for any role and question.
  • No role loses an answer it may see.
  • Each answer may draw on at least three chunks.
  • Chunks are at most 80 words.
  • Consecutive chunks overlap.
Open the brief in the Retrieval workbench, change the settings until they meet the brief, and press Check there.

Delete the medical report

The medical report for claim CL-2025-00107 must be deleted. For each way of deleting it, decide whether anything of it is left for the assistant to find.

Delete every chunk whose document id is the report's
Delete the chunk the search shows first for the report
Re-index only the documents that changed this week
Delete the file from the document store, and leave the index to catch up

Which document does the answer cite?

The claims handler asks each of the workbench's questions, with the access filter before ranking and the default chunking. Choose the document each answer cites first.

Is a burst pipe covered by home insurance?
Why was the reserve on claim CL-2025-00042 raised?
What injuries were treated on claim CL-2025-00107?
What was the loss ratio in the third quarter?
How quickly must a handler set a reserve?

On Azure

Checked against Microsoft's documentation on 18 October 2026.

The same pipeline on Azure:

  • Azure AI Search holds the index: text fields searched with BM25, vector fields searched by similarity, and hybrid queries that run both and merge the results by Reciprocal Rank Fusion; a semantic ranker can reorder the top results. It also underpins Foundry IQ, the knowledge layer for agents in Microsoft Foundry.
  • Integrated vectorization: an indexer reads the documents from storage, a skillset chunks them (the Text Split skill, or Azure Content Understanding for layout-aware parsing) and embeds each chunk with an Azure OpenAI embedding model such as text-embedding-3-small or text-embedding-3-large; index projections write one search document per chunk, with the parent's fields copied on.
  • Access: the generally available pattern is a security filter: a filterable field on every chunk holding the Entra group ids that may read it, and a search.in filter on every query. Built-in document-level access (ACLs and RBAC scopes from ADLS Gen2, SharePoint permissions, and Microsoft Purview sensitivity labels) is in preview; when documents are chunked, the permission fields must be projected onto every chunk.
  • Deletion: the blob indexer removes a document's search documents when its blob is soft-deleted (native soft delete or a metadata flag); a push pipeline deletes by key, which is why every chunk's key must lead back to its document.

Keep the search service behind a private endpoint, and give the assistant's identity only the Search Index Data Reader role.

Take it to work

Retrieval design sheet

Design how documents become an index an assistant may answer from.

Documents

  • Each document type, its owner and its classification

Chunking

  • Strategy per type, size and overlap
  • Metadata every chunk carries

Access

  • The field that holds each chunk's readers
  • Where the filter runs: before ranking

Freshness and deletion

  • How a changed or deleted document reaches the index, and how fast

Answers

  • How many chunks an answer may use, and how it cites them

Tools in this chapter

  • Retrieval workbench · Chunk and index Harbour Mutual's documents with their access rights, and ask questions as different roles.

Terms taught here: ChunkEmbeddingRetrieval-augmented generation

An unhandled error has occurred. Reload 🗙

Reconnecting…

Your connection to the Cloud Data Architecture Lab dropped, probably a Wi-Fi blip. Hold on while it reconnects.

The connection could not be restored. The page will reload in a few seconds.