Codiatech Blog
How to Build an Internal AI Assistant
Plan a read-only internal RAG assistant with a document manifest, labeled questions, failure diagnosis, release criteria, and rollback ownership.

Start with a set of questions one team asks regularly and can answer from approved documents. This guide helps business and IT teams design a first internal AI assistant, identify where errors originate, and decide what evidence is enough to accept a pilot. For employees, the change is from searching for a document to getting an answer tied to the relevant passage. The practical test is whether the assistant finds that passage and explains it accurately, including any exceptions.
1. Start with One Read-Only Workflow
Consider a facilities team that needs to know what paperwork to submit after scheduled maintenance. Its assistant can answer from approved maintenance procedures. The business owner decides which procedures govern and which mistakes would disrupt the work. IT owns authentication, search, and operations. Record the pilot audience, the allowed collection, and the topics outside scope. Keep the first release read-only. Closing work orders, updating records, or sending notifications would require a separate design with explicit permissions and human approval.
2. Build the Ingestion and Answer Flows
The ingestion pipeline reads approved files, extracts their text, and stores useful sections in a search index. When someone asks a question, the application authenticates the user, retrieves passages they can access, and sends selected evidence to the model with the question. This is retrieval-augmented generation, or RAG. The passages supply context for that request while the model weights stay fixed. Check the chosen service's terms for data retention and training use separately. Individual chat subscriptions, business and enterprise workspaces, and developer APIs have distinct product scopes. Microsoft's architecture describes one way to build this flow on Azure. Microsoft Learn RAG architecture guide.
3. Create a Document Manifest and Test Extraction
Record a stable document ID, version, effective status, owner, and source URL for each file. Carry the ID and version through to every chunk, along with a chunk ID and a page, section, or table reference. Compare important dates in scanned PDFs, row and column relationships in tables, and exceptions in multipage procedures against the originals. If a maintenance deadline appears in a table and the exception is in a footnote, check that search can surface both. Use cases like these to choose how to split the material and how much context to retain. Chunk size depends on the corpus and the questions people ask.
4. Enforce Permissions Before Calling the Model
Build retrieval permissions from the authenticated session and pass only authorized passages to the model. Missing permission information should stop retrieval safely. Ask the same question using two test accounts with different entitlements and inspect the passage IDs sent to the model. How quickly revocation takes effect depends on where permissions are checked and when any indexed permission metadata is synchronized. If you cache results, test a permission change in an existing session as well. Microsoft Learn document-level access control guide.
5. Use Labeled Questions to Isolate Failures
Build a test set from the way people actually ask questions. For each case, record the user's role, the expected document version and section, the facts a good answer should include, and the required behavior. Add questions with no known answer, conflicting sources, or an answer found only in a superseded document. If a section never made it into the index, inspect extraction. If the correct passage is indexed but never selected, check the permission filter and ranking. If the passage reaches the model and the deadline still comes out wrong, investigate generation. Rerun the question with the expected passages supplied directly in a controlled test to help isolate that last failure.
6. Evaluate the Evidence and the Answer Separately
First, check whether retrieval found all the evidence needed. Then score the answer on whether it is grounded in the supplied passages, includes the required details, and addresses the user's question. A working citation can still point to a passage that fails to support the claim beside it. For a stated paperwork deadline, have a reviewer verify the version, the relevant line, and any exception. Ask staff to answer the same questions through their usual document search to establish a baseline. Automated evaluator scores can flag regressions and help reviewers choose what to inspect. Base acceptance on human review and the business impact of observed errors too. Microsoft Foundry RAG evaluators.

7. Define When to Clarify, Abstain, or Escalate
If someone omits the type of maintenance, the assistant can ask a focused follow-up question. If the available documents provide no basis for an answer, it should say so. Conflicting current procedures should go to the document owner. Treat retrieved text as lower-trust data. In a controlled test, place a harmless instruction in a sample document asking the assistant to change its assigned scope. Check that it ignores the embedded instruction and stays within the configured sources. A pass establishes the behavior observed in that test case.
8. Tie Release Acceptance to Ongoing Operations
Record application, model, index, and prompt versions alongside test results. Agree with the business owner on what justifies widening the pilot, requesting fixes, or pausing it. For example, stop the rollout if an unauthorized passage reaches model context. Add document updates, deletion, and permission revocation to release testing. Removing a source file can leave its chunks in the index. Verify that all associated chunks are explicitly removed and that search no longer serves cached copies. Microsoft Learn guide to deleting indexed documents.
In operation, monitor empty searches, samples of unsupported answers, update lag, and response latency. Assign a rollback owner and define when to disable the assistant. Before restoring an older index, check that it cannot reintroduce deleted documents or revoked permissions. For help scoping the pilot, designing its checks, and assigning operating responsibilities, see Codiatech's AI-powered systems service.
Primary source: learn.microsoft.com