This project uses a Retrieval-Augmented Generation (RAG) system that utilizes multiple PDFs as knowledge sources. The PDFs are stored as vector embeddings in a vector store. When a user asks a question, the system retrieves relevant information from these documents using AWS Bedrock models. The response is generated based on the selected model (e.g., Claude or Llama 2).
To run this project, you need the following Python libraries:
PyPDFLangchainStreamlitFAISS-CPUboto3and AWS CLI (configured)
The RAG system follows these steps:
- Read all PDFs from a specified folder.
- Split the documents into manageable chunks.
- Create vector embeddings using Amazon Titan.
- Store the embeddings in a FAISS vector database.
- Perform a similarity search in the vector store based on the user’s question.
- Retrieve the most relevant document chunks.
- Feed the retrieved chunks along with a prompt to an LLM model via AWS Bedrock.
- The LLM generates an answer based on the provided context and prompt.
Run the Streamlit application to interact with the system:
streamlit run app.pyEnsure that your AWS CLI credentials are properly set up before executing the program.
This RAG-based system enhances LLM responses by grounding them in authoritative documents, improving accuracy and reliability. By leveraging AWS Bedrock and FAISS, it efficiently retrieves and generates contextually relevant answers.