AI Help

How do I make my RAG chatbot search only documents from a selected department?

Apply department filtering using trusted metadata and authorization checks outside the model, then verify the returned documents.

Steps to follow

  1. Tag indexed files or chunks with department and access metadata supported by your retrieval system.
  2. Determine permitted departments from the authenticated user's permissions and apply the documented retrieval filter.
  3. Test an allowed question and a cross-department question. Inspect returned IDs and apply access checks before sending context to the model.

Example in practice

Illustrative example. A sales user can retrieve sales guidance while an HR-only document remains outside that user's retrieval scope.

Related AI help

Official guidance

OpenAI documentation