Design a solution that uses an LLM to query a legacy knowledge base. How do you handle data security and context limits?