langchain/templates/rag-aws-kendra
2023-10-29 15:50:09 -07:00
..
rag_aws_kendra notebook fmt (#12498) 2023-10-29 15:50:09 -07:00
tests Added a rag template for Kendra (#12470) 2023-10-28 08:58:28 -07:00
LICENSE Added a rag template for Kendra (#12470) 2023-10-28 08:58:28 -07:00
main.py notebook fmt (#12498) 2023-10-29 15:50:09 -07:00
poetry.lock Added a rag template for Kendra (#12470) 2023-10-28 08:58:28 -07:00
pyproject.toml Added a rag template for Kendra (#12470) 2023-10-28 08:58:28 -07:00
README.md Added a rag template for Kendra (#12470) 2023-10-28 08:58:28 -07:00

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 stacks 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.