The Brief
Streaming RAG Pipeline
You're building a customer-support RAG system for a SaaS company.
Constraints - Stream responses token-by-token to the client. - Every factual claim must cite a source from the provided corpus. - Token budget: 8,000 output tokens per query. - Latency budget: first token in <600ms.
Corpus ~2,400 docs (provided as JSON). Mix of marketing, docs, and changelog.
Success rubric 1. Streams correctly to client. 2. All factual claims cited. 3. Doesn't fabricate citations. 4. Hold-out test: 12 unseen queries, 80% must score "accurate" by judge model.
You may use - file_search (deterministic over the corpus) - code_run (Python sandbox) - judge: (request a second-opinion eval)
What you produce: a runnable agent loop + an explanation of your token-economy choices.