← Questions
Design a chatbot over structured and unstructured company data
0
I was asked this
No reports yet. Sign in to say where you were asked it.
An AI system design interview question asked in Google's system design round, last asked Feb 2026. It tests llm, rag and text-to-sql.
Design an assistant that answers employees' questions using two kinds of company data: structured data in databases and warehouses (tables of sales, tickets, inventory) and unstructured data in documents (wikis, PDFs, chat threads). A question may need either kind, or both.
Requirements
- Functional:
- Answer natural-language questions such as "What were EMEA sales last quarter, and what did the review doc say caused the drop?"
- Route each question to SQL generation over tables, retrieval over documents, or both, and combine the results.
- Ground answers in the sources and cite them (tables and queries used, document passages).
- Respect every user's access rights to tables, rows and documents.
- Non-functional: answers in a few seconds, cost per question under control, no leaks across permission boundaries, an audit trail of what was queried.
Clarifying questions
- How many users, documents and tables? How often does the data change?
- How are permissions defined today, per table, row, document or group?
- How accurate must numeric answers be, and is a wrong number worse than no answer?
- Which LLMs are allowed, and can data leave the company?
What a strong answer covers
- Ingestion: documents chunked, embedded and indexed with their access lists; table schemas, column descriptions and example queries indexed for SQL generation.
- The request path: intent and routing, schema retrieval and SQL generation with validation (read-only, limits, dry run), document retrieval with hybrid keyword and vector search plus reranking, then an answer step that cites both.
- Access control enforced at retrieval and query time with the user's identity, never left to the model.
- Evaluation: a set of real questions with expected answers, SQL accuracy measured by results rather than text, retrieval recall, groundedness, human review; online feedback and monitoring.
- Latency and cost: caching, a small model for routing, a large one only for hard steps, streaming the answer.
Follow-ups
- The generated SQL is plausible but wrong. How do you catch it?
- A document the user may not see contains the answer. What should the bot say?
- How do you keep the index fresh when documents change hourly?
Where it's asked
- Google · System design · Last asked Feb 202645 min · Whiteboard for the diagram, a doc for requirements and capacity math
What it tests
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing
