Skip to content

Commit cf3dfee

Browse files
committed
chore(doc): started updating the readme
1 parent b264ac2 commit cf3dfee

File tree

1 file changed

+8
-25
lines changed
  • src/patterns/gen-ai/aws-rag-appsync-stepfn-kendra

1 file changed

+8
-25
lines changed

src/patterns/gen-ai/aws-rag-appsync-stepfn-kendra/README.md

+8-25
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,13 @@
3434

3535
## Overview
3636

37-
This CDK construct creates a pipeline for RAG (retrieval augmented generation) source. It ingests documents and then converts them into text formats. The output can be used for scenarios with long context windows. This means that your system can now consider and analyze a significant amount of surrounding information when processing and understanding text. This is especially valuable in tasks like language understanding and document summarization.
37+
This CDK construct creates a data ingestion pipeline using Amazon Kendra.
3838

39-
Files in PDF format are uploaded to an input Amazon Simple Storage Service (S3) bucket. Authorized clients (Amazon Cognito user pool) will trigger an AWS AppSync mutation to start the ingestion process, and can use subscriptions to get notifications on the ingestion status. The mutation call will trigger an AWS Step Function with three different steps:
40-
- Input validation: an AWS Lambda function will verify the input formats of the files requested for ingestion. If the files are in a format which is not supported by the pipeline, an error message will be returned.
41-
- Transformation: the input files are processed in parallel using a [Map](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-map-state.html) state through an AWS Lambda. The function uses the [LangChain](https://www.langchain.com/) client to get the content of each file and store the text file in the output bucket. This is useful for workflows which want to use a long context window approach and send the entire file as context to a large language model. If the file name already exists in the output bucket, the input file will not be processed.
42-
- Embeddings step: Files processed and stored in the output S3 bucket are consumed by an AWS Lambda function. Chunks from documents are created, as well as text embeddings using Amazon Bedrock (model: amazon.titan-embed-text-v1). The chunks and embeddings are then stored in a knowledge base (OpenSearch provisioned cluster). Make sure the model (amazon.titan-embed-text-v1) is enabled in your account. Please follow the [Amazon Bedrock User Guide](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html) for steps related to enabling model access.
43-
44-
Documents stored in the knowledge base contain the following metadata:
45-
- Timestamp: when the embeddings were created (current time in seconds since the Epoch)
46-
- Embeddings model used: amazon.titan-embed-text-v1
39+
Files in [Amazon Kendra supported formats](https://docs.aws.amazon.com/kendra/latest/dg/index-document-types.html) are uploaded to an input Amazon Simple Storage Service (S3) bucket. Authorized clients (Amazon Cognito user pool) will trigger an AWS AppSync mutation to start the ingestion process, and can use subscriptions to get notifications on the ingestion status. The mutation call will trigger an AWS Step Function.
4740

4841
If you have multiple workflows using GraphQL endpoints and want to use a single endpoint, you can use an [AppSync Merged API](https://docs.aws.amazon.com/appsync/latest/devguide/merged-api.html). This construct can take as a parameter an existing AppSync Merged API; if provided, the mutation call and subscription updates will be targeted at the Merged API.
4942

50-
This construct will require an existing Amazon OpenSearch provisioned cluster. You can follow the steps in the official [AWS Developer Guide](https://docs.aws.amazon.com/kendra-service/latest/developerguide/createupdatedomains.html) to create and manage your OpenSearch domain.
51-
52-
AWS Lambda functions provisioned in this construct use [Powertools for AWS Lambda (Python)](https://github.com/aws-powertools/powertools-lambda-python) for tracing, structured logging, and custom metrics creation. The table below provides the created metrics and the name of the service used, and can be accessed from Amazon CloudWatch Logs.
53-
54-
| **AWS Lambda** | **Service** | **Custom Metrics** |
55-
|:-------------|:----------------|-----------------|
56-
| input_validation |INGESTION_INPUT_VALIDATION | SupportedFile (number of requests which provide a supported file format), UnsupportedFile (number of requests which provide an unsupported file format) |
57-
| s3_file_transformer | INGESTION_FILE_TRANSFORMER | N/A |
58-
| embeddings_job | INGESTION_EMBEDDING_JOB | N/A |
43+
This construct will require an existing Amazon Kendra index. You can follow the steps in the official [AWS Developer Guide](https://docs.aws.amazon.com/kendra/latest/dg/create-index.html) to create and manage your Amazon Kendra index.
5944

6045
Here is a minimal deployable pattern definition:
6146

@@ -301,23 +286,21 @@ The resources not created by this construct (Amazon Cognito User Pool, Amazon Op
301286

302287
When you build systems on AWS infrastructure, security responsibilities are shared between you and AWS. This [shared responsibility](http://aws.amazon.com/compliance/shared-responsibility-model/) model reduces your operational burden because AWS operates, manages, and controls the components including the host operating system, virtualization layer, and physical security of the facilities in which the services operate. For more information about AWS security, visit [AWS Cloud Security](http://aws.amazon.com/security/).
303288

304-
This construct requires you to provide an existing Amazon Cognito User Pool and a provisioned Amazon OpenSearch cluster. Please refer to the official documentation on best practices to secure those services:
289+
This construct requires you to provide an existing Amazon Cognito User Pool and an existing Amazon Kendra index. Please refer to the official documentation on best practices to secure those services:
305290
- [Amazon Cognito](https://docs.aws.amazon.com/cognito/latest/developerguide/security.html)
306-
- [Amazon OpenSearch Service](https://docs.aws.amazon.com/kendra-service/latest/developerguide/security.html)
291+
- [Amazon Kendra](https://docs.aws.amazon.com/kendra/latest/dg/what-is-kendra.html)
307292

308293
Optionnaly, you can provide existing resources to the constructs (marked optional in the construct pattern props). If you chose to do so, please refer to the official documentation on best practices to secure each service:
309294
- [Amazon Simple Storage Service](https://docs.aws.amazon.com/AmazonS3/latest/userguide/security-best-practices.html)
310295
- [Amazon VPC](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-best-practices.html)
311-
- [Amazon EventBridge](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-security.html)
312296
- [AWS AppSync](https://docs.aws.amazon.com/appsync/latest/devguide/best-practices.html)
313-
- [AWS Secrets Manager](https://docs.aws.amazon.com/config/latest/developerguide/security-best-practices-for-Secrets-Manager.html)
314297

315-
If you grant access to a user to your account where this construct is deployed, this user may access information stored by the construct (Amazon Simple Storage Service buckets, Amazon OpenSearch cluster, Amazon CloudWatch logs). To help secure your AWS resources, please follow the best practices for [AWS Identity and Access Management (IAM)](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html).
298+
If you grant access to a user to your account where this construct is deployed, this user may access information stored by the construct (Amazon Simple Storage Service buckets, Amazon Kendra, Amazon CloudWatch logs). To help secure your AWS resources, please follow the best practices for [AWS Identity and Access Management (IAM)](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html).
316299

317300
AWS CloudTrail provides a number of security features to consider as you develop and implement your own security policies. Please follow the related best practices through the [official documentation](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/best-practices-security.html).
318301

319302
> **Note**
320-
> This construct requires you to provide documents in the input assets bucket. You should validate each file in the bucket before using this construct. See [here](https://cheatsheetseries.owasp.org/cheatsheets/File_Upload_Cheat_Sheet.html) for file input validation best practices.
303+
> You should validate each file before you ingest them using this construct. See [here](https://cheatsheetseries.owasp.org/cheatsheets/File_Upload_Cheat_Sheet.html) for file input validation best practices.
321304
> Ensure you only ingest the appropriate documents into your knowledge base. Any results returned by the knowledge base is eligible for inclusion into the prompt; and therefore, being sent to the LLM. If using a third-party LLM, ensure you audit the documents contained within your knowledge base.
322305
> This construct provides several configurable options for logging. Please consider security best practices when enabling or disabling logging and related features. Verbose logging, for instance, may log content of API calls. You can disable this functionality by ensuring observability flag is set to false.
323306
@@ -340,7 +323,7 @@ To view the service quotas for all AWS services in the documentation without swi
340323

341324
When deleting your stack which uses this construct, do not forget to go over the following instructions to avoid unexpected charges:
342325
- empty and delete the Amazon Simple Storage Bucket(s) created by this construct if you didn't provide existing ones during the construct creation
343-
- empty the data stored in the knowledge base (Amazon OpenSearch provisioned cluster), as well as the index created if an existing one was not provided
326+
- empty the data stored in the knowledge base (Amazon Kendra)
344327
- if the observability flag is turned on, delete all the associated logs created by the different services in Amazon CloudWatch logs
345328

346329
***

0 commit comments

Comments
 (0)