The knowledge base: rules into Azure AI Search
The rules become a knowledge base the auditor can search: the FTC PDFs are loaded, split into chunks, embedded with text-embedding-3-small, and stored as vectors in Azure AI Search. It is the RAG data pipeline from earlier in the course, built for real on a cloud vector store.
Last updated: 15 Oct, 2026 · LLMOps
The RAG data pipeline walked this chain in the abstract: ingest, parse, split, chunk, embed, store, retrieve. Here it is the same chain, applied to the FTC rule documents, with Azure AI Search as the store.
From PDF to vectors
from langchain_community.document_loaders import PyPDFLoader
from langchain_text_splitters import RecursiveCharacterTextSplitter
# the two FTC rule PDFs are loaded page by page
loader = PyPDFLoader("data/ftc-influencer-guidelines.pdf")
raw_docs = loader.load()
# split into overlapping chunks so a rule is not cut in half at a boundary
splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
chunks = splitter.split_documents(raw_docs)The chunk size is 1,000 characters with a 200-character overlap, the settings the video uses. The overlap is why a rule that straddles two chunks still appears whole in at least one of them.
from langchain_openai import AzureOpenAIEmbeddings
from langchain_community.vectorstores.azuresearch import AzureSearch
# the same embedding model the auditor's queries will use, so query and document match
embeddings = AzureOpenAIEmbeddings(azure_deployment="text-embedding-3-small")
store = AzureSearch(
azure_search_endpoint=AZURE_SEARCH_ENDPOINT,
azure_search_key=AZURE_SEARCH_API_KEY,
index_name="brand-compliance-rules",
embedding_function=embeddings.embed_query,
)
store.add_documents(chunks) # the rules are now searchable by meaningThe ops view
- The embedding model is part of the index. The auditor's query must be embedded with the same text-embedding-3-small, or the vectors do not compare. Swapping it means re-embedding every rule.
- Re-indexing is a job, not a request. New guidance means loading, chunking and embedding again; it runs when the rules change, not on every audit.
- What you version is the chunks and their vectors, alongside the chunk settings, so an audit can be reproduced against the exact rules that were live.
Related
- Explain why a 200-character overlap helps when a single FTC rule is longer than one chunk.
- Say what has to be re-run if the FTC updates one of the two PDFs.
Slow is fine. Stopping is the only problem.