Core RAG functions in RAGTools
mainRAGTools provides a modular pipeline for Retrieval-Augmented Generation. The primary functions are:
build_index(documents; ...): Creates aChunkIndexfrom a list of documents.airag(index; question): An end-to-end function that performs both retrieval and generation, returning anAIMessage.retrieve(index, question): Retrieves relevant chunks from the index for a given question. Returns aRAGResult.generate!(index, result): Takes aRAGResult(fromretrieve) and generates an answer from the retrieved chunks.annotate_support: Highlights which parts of an answer are supported by the index documents. This is applied automatically when usingpprint(result).build_qa_evals: Generates question-answer pairs from a corpus for evaluating RAG models.