This project is a Question Answering application with Large Language Models (LLMs) and Amazon Kendra. An application using the RAG(Retrieval Augmented Generation) approach retrieves information most relevant to the user’s request from the enterprise knowledge base or content, bundles it as context along with the user’s request as a prompt, and then sends it to the LLM to get a GenAI response.
LLMs have limitations around the maximum word count for the input prompt, therefore choosing the right passages among thousands or millions of documents in the enterprise, has a direct impact on the LLM’s accuracy.
In this project, Amazon Kendra is used for knowledge base.
The overall architecture is like this:
Before using a foundational model in Bedrock your account needs to be granted access first.
Follow the steps here to add models: Amazon Bedrock - Add model access
Some models require some additional information and take some time before you are granted access. Once the model shows "Access granted" on the Model Access page, you should be able to call the invoke_model()
function without the error.
- Deploy the cdk stacks (For more information, see here).
- An Amazon Kendra for knowledge base.
- Open JupyterLab in SageMaker Studio and then open a new terminal.
- Run the following commands on the terminal to clone the code repository for this project:
git clone --depth=1 https://github.com/aws-samples/qa-app-with-rag-using-amazon-bedrock-and-kendra.git
- Run Streamlit application. (For more information, see here)
- Amazon Bedrock - Add model access
- Amazon Bedrock Workshop
- Quickly build high-accuracy Generative AI applications on enterprise data using Amazon Kendra, LangChain, and large language models (2023-05-03)
- Build a powerful question answering bot with Amazon SageMaker, Amazon OpenSearch Service, Streamlit, and LangChain (2023-05-25)
- Build Streamlit apps in Amazon SageMaker Studio (2023-04-11)
- Question answering using Retrieval Augmented Generation with foundation models in Amazon SageMaker JumpStart (2023-05-02)
- Use proprietary foundation models from Amazon SageMaker JumpStart in Amazon SageMaker Studio (2023-06-27)
- LangChain - A framework for developing applications powered by language models.
- Streamlit - A faster way to build and share data apps
- Improve search relevance with ML in Amazon OpenSearch Service Workshop - Module 7. Retrieval Augmented Generation
- rag-with-amazon-opensearch-and-sagemaker - Question Answering application with Large Language Models (LLMs) and Amazon OpenSearch Service
- rag-with-amazon-postgresql-using-pgvector - Question Answering application with Large Language Models (LLMs) and Amazon Aurora Postgresql
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.