.. | ||
rag_aws_kendra | ||
tests | ||
LICENSE | ||
main.py | ||
poetry.lock | ||
pyproject.toml | ||
README.md |
RAG AWS Kendra
Amazon Kendra is an intelligent search service powered by machine learning (ML).
Here we will use Anthropic Claude
for text generation and Amazon Kendra
for retrieving documents. Together, with these two services, this application uses a Retrieval chain to answer questions from your documents.
(See this page for additional context on building RAG applications with Amazon Kendra.)
Code here uses the boto3
library to connect with the Bedrock service. See this page for setting up and configuring boto3 to work with an AWS account.
Kendra Index
You will need a Kendra Index setup before using this template. For setting up a sample index, you can use this Cloudformation template to create the index. This template includes sample data containing AWS online documentation for Amazon Kendra, Amazon Lex, and Amazon SageMaker. Alternately, if you have an Amazon Kendra index and have indexed your own dataset, you can use that. Launching the stack requires about 30 minutes followed by about 15 minutes to synchronize it and ingest the data in the index. Therefore, wait for about 45 minutes after launching the stack. Note the Index ID and AWS Region on the stack’s Outputs tab.
Environment variables
The code assumes that you are working with the default
AWS profile and us-east-1
region. If not, specify these environment variables to reflect the correct region and AWS profile.
AWS_DEFAULT_REGION
AWS_PROFILE
This code also requires specifying the KENDRA_INDEX_ID
env variable which should have the Index ID of the Kendra index. Note that the Index ID is a 36 character alphanumeric value that can be found in the index detail page.