How to Implement Retrieval-Augmented Generation in Custom AI Applications