KatInterview

Build a Documentation and Data Q&A System with LLMs

Machine LearningModel answer
HardModel answerMachine Learningretrieval-augmented generationllmsystem architecture

Last updated

Design an end-to-end RAG system that answers questions from product documentation and queries user-specific metadata with secure, tenant-isolated access.

You're building an AI assistant that helps users interact with a complex enterprise SaaS platform. The assistant must handle two distinct capabilities:

Documentation queries: Answer questions about product features and how-to procedures using only the platform's official public documentation. Responses must include citations to specific sources.

User data queries: Answer questions about the logged-in user's own resources and metadata within the platform—such as "How many projects do I have?" or "Which datasets are largest?"—by securely accessing their data through existing APIs.

Design the complete system including:

  • Architecture for document processing, retrieval, and generation
  • How you'll handle user data access with proper authorization
  • Mechanisms to keep the assistant in scope (refusing off-topic questions)
  • Latency targets and how you'll meet them
  • Privacy considerations and audit requirements
  • Evaluation approach and production monitoring
  • How the system would handle example queries like "How do I set up authentication?" or "Show me my five most active user segments"

Provide architectural diagrams, API contracts, and concrete numbers where relevant. Explain key trade-offs in your design decisions.

Hints

Hint 1

Keep documentation retrieval and live data access as separate flows with different authorization models

Hint 2

Think about how you'll prevent the LLM from answering questions outside its intended domain

Hint 3

Consider what could go wrong if retrieval quality is poor or if data from different users gets mixed