Define a private portal and a testable outcome
Define a private portal and a testable outcome — Build and hand off a small private AI portal. One narrow use case; Teaching documents with owners; A contract before the page. Practical assignment: Define a private portal and a testable outcome.
Demo edition. The materials are undergoing editorial review.
Topics covered
- One narrow use case
- Teaching documents with owners
- A contract before the page
One narrow use case
Build a private teaching portal where two users see only authorized documents and ask questions about their text. The browser displays answers and sources, the backend enforces access, and a model adapter stays separate. Its first implementation is a deterministic local stub that returns excerpts, not an LLM. This tests the complete path without paid APIs or large model downloads. Do not label it a working AI model: display stub-extractive. Replacing the adapter later requires separate resource, data and evaluation decisions. Scope is read-only knowledge without uploads, email, payments or shell tools. Listen only on 127.0.0.1. A concrete outcome is Alice receiving an authorized answer with a source while failing to read Bob’s private document even when she guesses its ID. Hiding a link in the browser is not authorization.
Teaching documents with owners
Create portal-lab/knowledge.json using the fictional English facts below. Short documents allow manual reference answers. returns belongs to Alice, budget to Bob, and support to both through owner=shared. source is an internal label, not an external URL, exposing provenance without arbitrary navigation. Version binds answers to a rule revision. A receipt query should find authorized returns; payroll should produce insufficient sources because that text is absent. Real knowledge administration belongs to an authorized operator, not a browser field that can change owner. Keep the file outside public and never add it to static serving for convenient debugging. This fixture teaches isolation rather than describing a real shop. Preserve the initial fixture for tests so a later change to the fourteen-day rule does not silently change expectations.
[
{"id":"returns","owner":"alice","title":"Returns","version":1,"source":"training:returns-v1","text":"Returns require a receipt within 14 days."},
{"id":"budget","owner":"bob","title":"Budget","version":1,"source":"training:budget-v1","text":"The internal budget is 500 units."},
{"id":"support","owner":"shared","title":"Support","version":1,"source":"training:support-v1","text":"Support opens at 09:00."}
]
A contract before the page
Specify the API: GET /healthz returns only ok; GET /api/docs requires a credential and returns visible id/title/version/source; POST /api/answer accepts question and optional docIds. Expect 401 without credentials, the same 404 for unknown or unauthorized IDs, and 413 for excessive body size. Responses contain status, text, citations and mode=stub-extractive. Citations must belong to retrieved authorized passages rather than arbitrary model strings. Missing evidence returns insufficient_sources instead of invented facts. Static / and /app.js contain no knowledge and may load before authentication. This prototype uses a manually entered private bearer token kept out of localStorage. It is a loopback teaching mechanism, not a public identity provider. The backend derives ownership from verified credentials, never a request-body owner field. Test the contract before expanding scope.
Practical assignment
Define a private portal and a testable outcome
Continue to learning