Choosing the sources the assistant may use
Pointing an assistant at the whole shared drive is the fastest way to get confident wrong answers. Drafts, duplicates, superseded policies and personal notes all look like evidence to a retrieval system. Start with sources that have an owner and a review date: policies and procedures, product manuals, the employee handbook, approved templates and the internal help desk's articles.
Picture a hypothetical engineering consultancy whose procedures live in SharePoint, whose handbook is a set of PDFs and whose project lessons sit in Google Drive. A sensible first scope is the procedures and the handbook, because each has an owner who can confirm an answer is right. Project lessons can follow once their access rules are clear. Clear ownership of each source is part of data governance, and it is what makes an assistant correctable.
Ingestion and chunking
Ingestion connects to each source, converts every file to clean text and keeps its structure. Scanned PDFs need OCR first; document processing covers that step. Each document is then split into chunks small enough to retrieve precisely but large enough to make sense alone.
- Split along the document's own structure, by heading and section, rather than every few hundred characters, which cuts sentences and tables in half.
- Carry context into every chunk: the document title, the heading path and the effective date, so “the limit is three days” still means something on its own.
- Keep tables whole, or repeat the header row in each piece, so values keep their labels.
- Store metadata with each chunk: source, version, owner, language and access group.
Chunks are turned into embeddings, numeric representations of meaning, and stored in a vector database or in PostgreSQL with the pgvector extension. Semantic search alone struggles with exact terms such as policy codes, part numbers and names, so we combine it with keyword search and re-rank the results before the model sees them.
Permissions for every document
The assistant must never reveal a passage the person asking could not open themselves. That is enforced at retrieval: every chunk carries its access groups, and the search filters by the user's groups, taken from your identity provider or the source system, before any text reaches the model. Telling the model “do not mention confidential documents” is not a control.
- Sync permission changes promptly, so someone who loses access to a folder loses it in the assistant too.
- Test with two accounts that have different access, and check that the answers differ as they should.
- Leave the most sensitive material, such as HR cases and board papers, out of scope unless there is a strong reason and a separate design.
The principle is least privilege, applied to search results.
Citations people can check
Every answer should cite the passages it used, with a link that opens the document at the right section. Citations turn the assistant from an oracle into a fast way to find the source, and they let readers catch errors. We also check citations in code: each one must point to a passage that was actually retrieved for that question.
When retrieval finds nothing relevant, the assistant should say it does not know and name the document owner or team to ask. That answer is frustrating once and builds trust over time. Citations make AI hallucination visible rather than impossible, so answers that matter, such as safety procedures, should still be read against the source.
Keeping answers current
- Sync on change, using the source system's change notifications where it offers them, plus a scheduled full check to catch anything missed.
- Remove deleted and superseded documents from the index the same day, not only add new ones.
- Prefer the current approved version when two versions match, and show the document's date in the answer.
- Report gaps to owners: questions with no good answer, and old documents that are cited often.
An assistant is only as current as its sources. If the travel policy changed last month and the old PDF is still in the folder, the assistant will find it.
Evaluating answers before and after launch
Build a test set from questions staff already ask, taken from help channels and from emails to HR, IT and operations, with the expected answer and the source for each. Then measure separately:
- Retrieval: did the right passage come back near the top?
- Answer correctness: is the answer right and complete, according to the document owner?
- Citation accuracy: does each citation support the sentence it is attached to?
- Refusals: does the assistant decline when the answer is not in the sources?
Grade with simple rules where possible, a model-graded check for scale, and owner review for a sample. Rerun the whole set whenever the chunking, the model or the instructions change. AI agent testing and the LLM evaluation entry explain the method.
Arabic and English in one knowledge base
Staff may ask in Arabic about a document written in English, or the reverse. Multilingual embedding models retrieve across languages, but test them on your own content. Keyword search in Arabic needs normalisation, for example treating the different forms of alef as one and ignoring diacritics, or a search for one spelling misses another. The assistant answers in the language of the question and quotes the source in its original language, so nothing is lost in translation. A short bilingual glossary of internal terms, such as department and product names, improves both retrieval and answers. For more on Arabic language handling, see Arabic AI assistants.