The core loop

  • Chunk and embed source documents.
  • Retrieve relevant chunks for a user question.
  • Pass retrieved context to the model for grounded answers.

Design choices that matter

  • Chunk size, overlap, and metadata filters.
  • Embedding model and vector store selection.
  • Citation and refusal behavior when context is weak.

Security considerations

  • Enforce document-level authorization before retrieval.
  • Avoid leaking restricted content through prompt injection.
  • Separate tenant or team indexes when needed.

Evaluation basics

  • Test with real questions from the target audience.
  • Track groundedness, completeness, and refusal quality.
  • Iterate on chunking before swapping models.

Related reading