Add authenticated upload, review, retry and knowledge-selection HTTP flows with bounded JSON processing and frozen OCR policy. Preserve Gemini/OpenAI provider selection and fenced lifecycle semantics; retain FAQ preambles and uncertain vision candidates, and expose opt-in uncalibrated voice transport diagnostics. Include frontend integration examples, aligned contracts and deterministic regressions. Validation: 1767 provider-free tests passed; all 404 PostgreSQL scenarios have passing evidence across the documented runs.
182 lines
10 KiB
Markdown
182 lines
10 KiB
Markdown
# Live Document MVP - English Scenarios
|
|
|
|
Version 1.3 | 2026-10-07 | Current scenario reference; examples are acceptance
|
|
requirements, not observed runtime results.
|
|
|
|
Companions: [delivery plan](RAG-AI-Phase1-Delivery-Plan.md),
|
|
[implementation guide](RAG-Phase1-Implementation-Guide.md),
|
|
[API catalog](RAG-Phase1-API-Catalog.md) and
|
|
[database design](RAG-Phase1-Database-Design.md).
|
|
|
|
## 1. Product and user journey
|
|
|
|
Known users in one organization sign in. An admin uploads new supported files
|
|
from the browser, inspects uncertain extraction, activates ready documents and
|
|
starts a Persian voice conversation. Users hear supported document answers and
|
|
see retrieved sources plus available provider transcripts.
|
|
|
|
LangChain supplies the RAG/tool integration boundary. OpenAI Realtime manages
|
|
native audio; the backend owns secrets, identity, tools and scope. Existing
|
|
ingestion/embedding Phases 1-4 remain the processing foundation.
|
|
|
|
## 2. Four mandatory examples and unseen documents
|
|
|
|
| Example file | Required quality checks |
|
|
| --- | --- |
|
|
| 7364346504113364738_13450847753183.pdf | PDF reading order, word/digit order, real page locators and direct/page-fallback coverage |
|
|
| 5905170444656189186_13450510740952.pdf | Circular dates, percentages, conditions, negation and exceptions |
|
|
| photo_1_2026-10-06_09-05-11.jpg | Separate infographic groups and correct parent heading/description associations |
|
|
| -2348240626507047168_13449360743721.docx | Preserve all 100 Q&A associations; distinguish factual answers, behavioral scenarios and live-data placeholders |
|
|
|
|
These examples reveal required structures; they are not an upload filename/hash
|
|
allowlist or a four-document capacity limit. Upload additional previously unseen
|
|
files of the supported structures through the same UI without code changes.
|
|
Record declared limitations and understandable failures for unsupported/
|
|
unreadable/oversized content. Future total upload count is unknown; resource
|
|
bounds/backlog/capacity are explicit deployment decisions.
|
|
|
|
## 3. New browser upload and duplicate submission
|
|
|
|
The admin selects a new file/title. D01 validates actual type and configured
|
|
limits, stores immutable bytes and creates one inactive document/job.
|
|
A replay of the same idempotency key and bytes/title returns the same IDs.
|
|
A changed payload under that key conflicts. The same bytes with a new key
|
|
create a new independent document; no original overwrite or content version.
|
|
|
|
Show real queued/processing/ready/failed state; do not invent percentage progress.
|
|
A successful upload acknowledgement does not mean the file is searchable.
|
|
|
|
## 4. PDF/image review and same-output resume
|
|
|
|
Worker extraction identifies required page review and retains the exact bounded
|
|
image/block candidate under its current claim. It fails with a review-required
|
|
reason, zero published chunks and released lease.
|
|
|
|
The admin opens D06 and compares retained text with the original/rendered page.
|
|
D07 approves/rejects the digest with the required readability/order/completeness/
|
|
number/date/negation/exception checks and a note. D04 resumes the same eligible
|
|
document/job after approval. Retained inspected output is reused, rather than a
|
|
new OCR response silently inheriting approval. Further pages may need review.
|
|
|
|
A stale digest, other-organization candidate, client-supplied replacement text
|
|
or conflicting decision cannot alter evidence. Rejection keeps it unsearchable.
|
|
Partial candidates cannot be passed off as a complete validated artifact.
|
|
All pages/quality checks must finish before complete publication.
|
|
|
|
## 5. Word FAQ authority and inclusion
|
|
|
|
Extraction retains all original question/answer associations and locators.
|
|
This preserves source content, not proof that every entry is valid knowledge.
|
|
|
|
An explicit factual-corpus decision identifies approved factual FAQ groups
|
|
and excludes whole pairs that contain unapproved facts, behavioral scenarios
|
|
or current-value placeholders. Store that manifest separately from faithful
|
|
extraction; do not edit the original. Preserve valid question/answer grouping
|
|
through chunking. Empty eligible factual content fails clearly.
|
|
|
|
An entry that says a price or tariff is current without an approved value does
|
|
not authorize invented pricing. A behavioral example does not become a system
|
|
instruction through retrieval. No live business-data/telephony tool is promised.
|
|
|
|
## 6. Complete publication and active selection
|
|
|
|
Worker stages every vector using the frozen compatible profile and current
|
|
limits. A failed final batch leaves zero published chunks. Publish chunks,
|
|
ready state and succeeded job together under a valid token/unexpired lease.
|
|
A ready document stays inactive until the admin selects it.
|
|
|
|
A stale worker after lease expiry, interrupted claim, repeated publication
|
|
or uncertain commit cannot create a partial/duplicate searchable document.
|
|
Activation uses current knowledge_revision; stale selection conflicts.
|
|
|
|
## 7. Grounded spoken circular question
|
|
|
|
Create an owned voice conversation/session. Ask in Persian the equivalent of:
|
|
"What conditions and exceptions does this circular contain?"
|
|
|
|
The model calls search_knowledge with query and optional resolved context.
|
|
The backend resolves scope, embeds with the same compatible profile and returns
|
|
real evidence/document/chunk IDs and locators. The native Live model speaks a
|
|
concise answer with actual supported numbers/conditions; UI shows retrieved
|
|
sources and provider transcription when available. No numerical source content
|
|
is invented in this scenario description.
|
|
|
|
## 8. Follow-up, topic switch and ambiguity
|
|
|
|
Ask "What were its exceptions?" after a clearly identified circular.
|
|
Resolve the reference, retrieve fresh evidence and answer from it.
|
|
|
|
Then ask about a group in the infographic. Replace the old topic anchor and
|
|
retrieve that group's verified description. Do not carry unrelated circular
|
|
article/date assumptions into the new topic.
|
|
|
|
Ask "What about the next article?" without an unambiguous article/document.
|
|
Request clarification rather than choose an arbitrary similarity match.
|
|
|
|
## 9. Interruption and failure
|
|
|
|
Interrupt with the Persian equivalent of "Wait, only tell me the exceptions."
|
|
Stop/clear queued playback, mark partial output interrupted and suppress cancelled
|
|
tool results. A late result cannot restart the prior answer. The sixteen contract walkthroughs in [API 7.1.4](RAG-Phase1-API-Catalog.md) cover final progress after interruption, completed generation with queued playback, later output segments, duplicate/invalid progress, missing reports and frame/queue overflow, plus fast generation versus stalled playback, cancellation races, delayed user transcription, speaking/uncommitted input and third-turn supersession; these are expected behaviors, not executed browser acceptance.
|
|
|
|
For no supporting evidence, state the limitation. For conflicting evidence,
|
|
disclose conflict or ask clarification. For query embedding/search/provider
|
|
timeout, show a technical failure; do not report that no document exists.
|
|
If Live is disconnected, the UI shows the failure without inventing a spoken
|
|
response from the unavailable provider. Reconcile/close and start a fresh
|
|
session; seamless context restoration is deferred.
|
|
|
|
## 10. Knowledge removal, logout and ownership
|
|
|
|
Deactivate a document used in a session. Increment knowledge revision/access
|
|
epoch and make older context unusable; conservatively close active organization
|
|
sessions. A fresh session searches current active evidence. Old excerpts must
|
|
not reappear through poll, cached tool replay or late result delivery.
|
|
|
|
Logout/expiry closes linked sessions. A normal user cannot upload/review/select;
|
|
another user's conversation/session cannot be read, streamed or closed by
|
|
guessing its UUID. Admin status does not grant conversation ownership.
|
|
|
|
## 11. Persistence, unknown backlog and restart
|
|
|
|
New uploads wait durably while the single worker is busy. UI lists are paginated.
|
|
Admission/resource failures are explicit, and limits are published. This scenario
|
|
does not certify unlimited corpus size or concurrent voice capacity.
|
|
|
|
Restart preserves originals/jobs/ready documents and recorded decisions.
|
|
Interrupted jobs recover under fresh claims without duplicate publication.
|
|
Old API-owned media sessions/running tools become terminal and unusable;
|
|
users start fresh. Current-session transcript may be lost on page refresh;
|
|
durable full voice history and raw recording are deferred.
|
|
|
|
## 12. Evaluation and handoff
|
|
|
|
Map checks to MVP-01 through MVP-14. Independently annotate expected source
|
|
passages; do not use an indexed FAQ as the sole proof of its own retrieval.
|
|
Evaluate retrieval, answer support and spoken quality separately with roughly
|
|
15-20 initial questions and unseen-file questions.
|
|
|
|
Rehearse browser upload -> review if needed -> ready -> activate -> real Persian
|
|
voice -> shared retrieval -> spoken answer/sources on target HTTPS/network.
|
|
Record actual errors/latency/provider usage and limits, not invented accuracy
|
|
percentages or unexecuted acceptance claims.
|
|
|
|
### OCR supervisor deployment policy (2026-10-09)
|
|
|
|
`INGEST_OCR_REVIEW_REQUIRED` defaults to true and is backend-only. New ingestion
|
|
jobs freeze the boolean in `processing_profile.extraction.ocr_review_required`
|
|
(the existing immutable document-owned snapshot for its one job). Workers and
|
|
retries use that snapshot; absent fields in legacy profiles mean true. Preserve
|
|
existing profile bytes/digests; do not backfill applied records. False permits
|
|
clean OCR/vision output that passes existing automatic validation without a human
|
|
extraction decision. It never waives non-OCR review, warning/integrity/coverage
|
|
checks, independent factual-corpus approval, or explicit knowledge selection.
|
|
Automatic extraction remains quality_decision=passed; mixed inspected/automatic
|
|
PDFs use partially_reviewed with annotations only for inspected locators. Neither
|
|
automatic OCR nor its portions in mixed PDFs creates a human review
|
|
annotation/audit record. Ready publication remains inactive. Retained pending or
|
|
rejected candidates still block retry; deployment changes cannot waive them.
|
|
F01 capabilities.ocr_review_required is current deployment policy; D03 reports
|
|
frozen ocr_review_required, review_state and extraction_quality_decision.
|
|
See [Phase 3 handoff](../guides/realtime-agent-phase3-handoff.md).
|