diff --git a/lambda/aws-qa-appsync-opensearch/question_answering/src/requirements.txt b/lambda/aws-qa-appsync-opensearch/question_answering/src/requirements.txt index 3503e452..5b588aa5 100644 --- a/lambda/aws-qa-appsync-opensearch/question_answering/src/requirements.txt +++ b/lambda/aws-qa-appsync-opensearch/question_answering/src/requirements.txt @@ -1,7 +1,7 @@ aws-lambda-powertools==2.35.1 aws-xray-sdk==2.13.0 fastjsonschema -typing-extensions +typing-extensions>=4.12.2 aiohttp boto3>=1.34.66 botocore>=1.34.66 @@ -9,5 +9,5 @@ requests==2.32.0 requests-aws4auth==1.2.3 opensearch-py==2.4.2 numpy -langchain==0.2.11 -langchain-community==0.2.9 \ No newline at end of file +langchain==0.3.9 +langchain-community==0.3.9 \ No newline at end of file diff --git a/lambda/aws-rag-appsync-stepfn-kendra/generate_presigned_url/src/Dockerfile b/lambda/aws-rag-appsync-stepfn-kendra/generate_presigned_url/src/Dockerfile deleted file mode 100644 index 06747dea..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/generate_presigned_url/src/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM public.ecr.aws/lambda/python:3.11.2023.11.13.10-x86_64 - -# Installs python, removes cache file to make things smaller -RUN yum update -y && \ - yum install -y python3 python3-dev python3-pip gcc git && \ - rm -Rf /var/cache/yum - -# Copies requirements.txt file into the container -COPY requirements.txt ./ -# Installs dependencies found in your requirements.txt file -RUN pip install --upgrade pip -RUN pip install -r requirements.txt - -# Be sure to copy over the function itself! -COPY .. . - -# Points to the handler function of your lambda function -CMD ["generate_presigned_url.lambda_handler"] diff --git a/lambda/aws-rag-appsync-stepfn-kendra/generate_presigned_url/src/generate_presigned_url.py b/lambda/aws-rag-appsync-stepfn-kendra/generate_presigned_url/src/generate_presigned_url.py deleted file mode 100644 index 121170c8..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/generate_presigned_url/src/generate_presigned_url.py +++ /dev/null @@ -1,90 +0,0 @@ -# -# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance -# with the License. A copy of the License is located at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES -# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions -# and limitations under the License. -# -import os -import boto3 - -from aws_lambda_powertools import Logger, Tracer, Metrics -from aws_lambda_powertools.metrics import MetricUnit - -logger = Logger(service="GENERATE_PRESIGNED_URL") -tracer = Tracer(service="GENERATE_PRESIGNED_URL") -metrics = Metrics(namespace="PresignedURLService", service="GENERATE_PRESIGNED_URL") - -s3_client = boto3.client('s3') -S3_BUCKET_NAME = os.environ['S3_BUCKET_NAME'] - -def generate_presigned_url(bucket_name, object_name, expiration): - try: - return s3_client.generate_presigned_url( - 'put_object', - Params={'Bucket': bucket_name,'Key': object_name}, - ExpiresIn=expiration) - except Exception as e: - logger.error(f"Error generating presigned url: {str(e)}") - return None - -def isvalid_file_format(file_name: str) -> bool: - file_format = ['.pdf','.html','xml','.xslt','.md','.csv','.xlsx','.xls','.json','.rtf','.ppt','.docx','txt'] - if file_name.endswith(tuple(file_format)): - logger.info(f"File format: {file_name}") - return True - else: - logger.error(f'Invalid file format :: {file_format}') - return False - -@logger.inject_lambda_context(log_event=True) -@tracer.capture_lambda_handler -@metrics.log_metrics(capture_cold_start_metric=True) -def lambda_handler(event, context): - arguments = event.get('arguments', {}) - file_name = arguments.get('fileName', '') - expiration = arguments.get('expiration', 3600) - print(f'The file name is: {expiration}') - print(f'The expiration is: {file_name}') - if not file_name: - metrics.add_metric(name="InvalidRequest", unit=MetricUnit.Count, value=1) - return { - 'success': False, - 'message': 'FileName is required', - 'fileName': None, - 'url': None, - } - - if not isvalid_file_format(file_name): - return { - 'success': False, - 'message': 'Invalid file format', - 'fileName': file_name, - 'url': None, - } - - try: - presigned_url = generate_presigned_url(S3_BUCKET_NAME, file_name, expiration) - metrics.add_metric(name="PresignedURLGenerated", unit=MetricUnit.Count, value=1) - - except Exception as e: - logger.error(f"Error generating presigned url: {str(e)}") - metrics.add_metric(name="PresignedURLGenerationError", unit=MetricUnit.Count, value=1) - return { - 'success': False, - 'message': 'Error generating presigned URL', - 'fileName': file_name, - 'url': None, - } - - return { - 'success': True, - 'message': 'Presigned URL generated successfully', - 'fileName': file_name, - 'url': presigned_url, - } diff --git a/lambda/aws-rag-appsync-stepfn-kendra/generate_presigned_url/src/requirements.txt b/lambda/aws-rag-appsync-stepfn-kendra/generate_presigned_url/src/requirements.txt deleted file mode 100644 index 13fac99c..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/generate_presigned_url/src/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -aws-lambda-powertools -boto3>=1.34.29 -botocore>=1.34.29 -aws_xray_sdk diff --git a/lambda/aws-rag-appsync-stepfn-kendra/kendra_job_manager/src/Dockerfile b/lambda/aws-rag-appsync-stepfn-kendra/kendra_job_manager/src/Dockerfile deleted file mode 100644 index b34cf10a..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/kendra_job_manager/src/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM public.ecr.aws/lambda/python:3.11.2023.11.13.10-x86_64 - -# Installs python, removes cache file to make things smaller -RUN yum update -y && \ - yum install -y python3 python3-dev python3-pip gcc git && \ - rm -Rf /var/cache/yum - -# Copies requirements.txt file into the container -COPY requirements.txt ./ -# Installs dependencies found in your requirements.txt file -RUN pip install --upgrade pip -RUN pip install -r requirements.txt - -# Be sure to copy over the function itself! -COPY .. . - -# Points to the handler function of your lambda function -CMD ["update_job_status.lambda_handler"] diff --git a/lambda/aws-rag-appsync-stepfn-kendra/kendra_job_manager/src/requirements.txt b/lambda/aws-rag-appsync-stepfn-kendra/kendra_job_manager/src/requirements.txt deleted file mode 100644 index 13fac99c..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/kendra_job_manager/src/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -aws-lambda-powertools -boto3>=1.34.29 -botocore>=1.34.29 -aws_xray_sdk diff --git a/lambda/aws-rag-appsync-stepfn-kendra/kendra_job_manager/src/update_job_status.py b/lambda/aws-rag-appsync-stepfn-kendra/kendra_job_manager/src/update_job_status.py deleted file mode 100644 index 9fea92f6..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/kendra_job_manager/src/update_job_status.py +++ /dev/null @@ -1,57 +0,0 @@ -# -# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance -# with the License. A copy of the License is located at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES -# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions -# and limitations under the License. -# -import boto3 -from aws_lambda_powertools import Logger, Metrics, Tracer -import os -from aws_lambda_powertools.metrics import MetricUnit - -ddb_client = boto3.client('dynamodb') -logger = Logger(service="KENDRA_JOB_MANAGER") -tracer = Tracer(service="KENDRA_JOB_MANAGER") -metrics = Metrics(namespace="KendraJobManagerService", service="KENDRA_JOB_MANAGER") - -DOCUMENTS_TABLE = os.environ["DOCUMENTS_TABLE"] -dynamodb_client = boto3.resource('dynamodb') -table = dynamodb_client.Table(DOCUMENTS_TABLE) - -@logger.inject_lambda_context(log_event=True) -@tracer.capture_lambda_handler -@metrics.log_metrics(capture_cold_start_metric=True) -def lambda_handler(event, context): - try: - response = table.update_item( - Key={ - 'Id': event['KendraJobExecId'], - 'CreatedOn': event['CreatedOn'] - }, - ExpressionAttributeNames={ - '#status': 'Status' - }, - UpdateExpression="SET #status= :s", - ExpressionAttributeValues={':s': event['KendraJobStatus']}, - ReturnValues="UPDATED_NEW" - ) - logger.info(f"Update item response: {response}") - metrics.add_metric(name="SuccessfulUpdates", unit=MetricUnit.Count, value=1) - return { - "status": "Job status updated", - "response": response - } - - except Exception as e: - logger.error(f"Error updating DynamoDB: {str(e)}") - metrics.add_metric(name="UpdateFailures", unit=MetricUnit.Count, value=1) - return { - "status": "Error", - "errorMessage": str(e) - } diff --git a/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync/src/Dockerfile b/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync/src/Dockerfile deleted file mode 100644 index abac7a57..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync/src/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM public.ecr.aws/lambda/python:3.11.2023.11.13.10-x86_64 - -# Installs python, removes cache file to make things smaller -RUN yum update -y && \ - yum install -y python3 python3-dev python3-pip gcc git && \ - rm -Rf /var/cache/yum - -# Copies requirements.txt file into the container -COPY requirements.txt ./ -# Installs dependencies found in your requirements.txt file -RUN pip install --upgrade pip -RUN pip install -r requirements.txt - -# Be sure to copy over the function itself! -COPY .. . - -# Points to the handler function of your lambda function -CMD ["start_sync.lambda_handler"] diff --git a/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync/src/requirements.txt b/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync/src/requirements.txt deleted file mode 100644 index 13fac99c..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync/src/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -aws-lambda-powertools -boto3>=1.34.29 -botocore>=1.34.29 -aws_xray_sdk diff --git a/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync/src/start_sync.py b/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync/src/start_sync.py deleted file mode 100644 index cf1d2469..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync/src/start_sync.py +++ /dev/null @@ -1,65 +0,0 @@ -# -# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance -# with the License. A copy of the License is located at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES -# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions -# and limitations under the License. -# -import json -import datetime -from datetime import datetime, timezone -from aws_lambda_powertools import Logger, Tracer, Metrics -from aws_lambda_powertools.metrics import MetricUnit -import boto3 -import os - -logger = Logger(service="KENDRA_SYNC_JOB") -tracer = Tracer(service="KENDRA_SYNC_JOB") -metrics = Metrics(namespace="KendraSyncService", service="KENDRA_SYNC_JOB") - -KENDRA_INDEX_ID = os.environ['KENDRA_INDEX_ID'] -KENDRA_DATA_SOURCE_INDEX_ID = os.environ['KENDRA_DATA_SOURCE_INDEX_ID'] -DOCUMENTS_TABLE = os.environ['DOCUMENTS_TABLE'] -AWS_REGION = os.environ['AWS_REGION'] - -kendra_client = boto3.client('kendra') -ddb_resource = boto3.resource("dynamodb") -table = ddb_resource.Table(DOCUMENTS_TABLE) - -@logger.inject_lambda_context(log_event=True) -@tracer.capture_lambda_handler -@metrics.log_metrics(capture_cold_start_metric=True) -def lambda_handler(event, context): - try: - logger.info('event notification: ' + json.dumps(event)) - created = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") - resp = kendra_client.start_data_source_sync_job(Id=KENDRA_DATA_SOURCE_INDEX_ID, IndexId=KENDRA_INDEX_ID) - table.put_item( - Item={ - "Id": resp['ExecutionId'], - "CreatedOn": created, - "Status": "Syncing" - } - ) - - logger.info(f"Kendra data source sync job started with Execution ID: {resp['ExecutionId']}") - metrics.add_metric(name="SuccessfulSyncJobs", unit=MetricUnit.Count, value=1) - - return { - "KendraJobExecId": resp['ExecutionId'], - "CreatedOn": str(created) - } - - except Exception as e: - logger.error(f"Error starting Kendra data source sync job or writing to DynamoDB: {str(e)}") - metrics.add_metric(name="SyncJobErrors", unit=MetricUnit.Count, value=1) - - return { - "status": "Error", - "errorMessage": str(e) - } diff --git a/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync_status/src/Dockerfile b/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync_status/src/Dockerfile deleted file mode 100644 index 637dcff7..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync_status/src/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM public.ecr.aws/lambda/python:3.11.2023.11.13.10-x86_64 - -# Installs python, removes cache file to make things smaller -RUN yum update -y && \ - yum install -y python3 python3-dev python3-pip gcc git && \ - rm -Rf /var/cache/yum - -# Copies requirements.txt file into the container -COPY requirements.txt ./ -# Installs dependencies found in your requirements.txt file -RUN pip install --upgrade pip -RUN pip install -r requirements.txt - -# Be sure to copy over the function itself! -COPY .. . - -# Points to the handler function of your lambda function -CMD ["check_sync_status.lambda_handler"] diff --git a/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync_status/src/check_sync_status.py b/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync_status/src/check_sync_status.py deleted file mode 100644 index 923ed4c8..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync_status/src/check_sync_status.py +++ /dev/null @@ -1,61 +0,0 @@ -# -# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance -# with the License. A copy of the License is located at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES -# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions -# and limitations under the License. -# -from aws_lambda_powertools import Logger, Tracer, Metrics -from aws_lambda_powertools.metrics import MetricUnit -import boto3 -import os - -logger = Logger(service="KENDRA_SYNC_STATUS") -tracer = Tracer(service="KENDRA_SYNC_STATUS") -metrics = Metrics(namespace="KendraSyncService", service="KENDRA_SYNC_STATUS") - -KENDRA_INDEX_ID = os.environ['KENDRA_INDEX_ID'] -KENDRA_DATA_SOURCE_INDEX_ID = os.environ['KENDRA_DATA_SOURCE_INDEX_ID'] -DOCUMENTS_TABLE = os.environ['DOCUMENTS_TABLE'] - -kendra_client = boto3.client('kendra') -def get_kendra_data_sync_job_status(execution_id: str): - try: - jobs = kendra_client.list_data_source_sync_jobs(Id=KENDRA_DATA_SOURCE_INDEX_ID, IndexId=KENDRA_INDEX_ID) - logger.info(f"Kendra jobs: {jobs}") - if 'History' in jobs: - for job in jobs['History']: - if execution_id == job['ExecutionId']: - metrics.add_metric(name="SuccessfulStatusRetrievals", unit=MetricUnit.Count, value=1) - return job['Status'] - return None - except Exception as e: - logger.error(f"Error retrieving Kendra data source sync job status: {str(e)}") - metrics.add_metric(name="StatusRetrievalErrors", unit=MetricUnit.Count, value=1) - return "Error" - -@logger.inject_lambda_context(log_event=True) -@tracer.capture_lambda_handler -@metrics.log_metrics(capture_cold_start_metric=True) -def lambda_handler(event, context): - try: - job_status = get_kendra_data_sync_job_status(event['KendraJobExecId']) - - return { - "KendraJobExecId": event['KendraJobExecId'], - "KendraJobStatus": job_status if job_status else 'Syncing', - "CreatedOn": event['CreatedOn'], - } - except Exception as e: - logger.error(f"Error processing Lambda handler: {str(e)}") - metrics.add_metric(name="LambdaHandlerErrors", unit=MetricUnit.Count, value=1) - - return { - "status": "Error", - "errorMessage": str(e) - } diff --git a/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync_status/src/requirements.txt b/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync_status/src/requirements.txt deleted file mode 100644 index 13fac99c..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/kendra_sync_status/src/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -aws-lambda-powertools -boto3>=1.34.29 -botocore>=1.34.29 -aws_xray_sdk diff --git a/lambda/aws-rag-appsync-stepfn-kendra/start_kendra_sync_stepfn/src/Dockerfile b/lambda/aws-rag-appsync-stepfn-kendra/start_kendra_sync_stepfn/src/Dockerfile deleted file mode 100644 index a9862f63..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/start_kendra_sync_stepfn/src/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM public.ecr.aws/lambda/python:3.11.2023.11.13.10-x86_64 - -# Installs python, removes cache file to make things smaller -RUN yum update -y && \ - yum install -y python3 python3-dev python3-pip gcc git && \ - rm -Rf /var/cache/yum - -# Copies requirements.txt file into the container -COPY requirements.txt ./ -# Installs dependencies found in your requirements.txt file -RUN pip install --upgrade pip -RUN pip install -r requirements.txt - -# Be sure to copy over the function itself! -COPY .. . - -# Points to the handler function of your lambda function -CMD ["lambda.lambda_handler"] diff --git a/lambda/aws-rag-appsync-stepfn-kendra/start_kendra_sync_stepfn/src/lambda.py b/lambda/aws-rag-appsync-stepfn-kendra/start_kendra_sync_stepfn/src/lambda.py deleted file mode 100644 index 3d0d217a..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/start_kendra_sync_stepfn/src/lambda.py +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance -# with the License. A copy of the License is located at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES -# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions -# and limitations under the License. -# -import json -import datetime -from datetime import datetime, timezone -from aws_lambda_powertools import Logger, Tracer, Metrics -from aws_lambda_powertools.metrics import MetricUnit -import boto3 -import os - -logger = Logger(service="KENDRA_SYNC_JOB") -tracer = Tracer(service="KENDRA_SYNC_JOB") -metrics = Metrics(namespace="KendraSyncService", service="KENDRA_SYNC_JOB") -STEP_FUNCTION_ARN = os.environ['STEP_FUNCTION_ARN'] -sfn_client = boto3.client('stepfunctions') - -@logger.inject_lambda_context(log_event=True) -@tracer.capture_lambda_handler -@metrics.log_metrics(capture_cold_start_metric=True) -def lambda_handler(event, context): - created = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") - try: - response = sfn_client.start_execution( - stateMachineArn=STEP_FUNCTION_ARN, - ) - logger.info(f"Started step function execution: {response['executionArn']}") - return { - "ExecutionArn": response['executionArn'], - "StartDate": str(created) - } - except Exception as e: - metrics.add_metric(name="StepFnErrors", unit=MetricUnit.Count, value=1) - return { - "Status": "Error", - "errorMessage": str(e), - "CreatedOn": str(created) - } diff --git a/lambda/aws-rag-appsync-stepfn-kendra/start_kendra_sync_stepfn/src/requirements.txt b/lambda/aws-rag-appsync-stepfn-kendra/start_kendra_sync_stepfn/src/requirements.txt deleted file mode 100644 index 13fac99c..00000000 --- a/lambda/aws-rag-appsync-stepfn-kendra/start_kendra_sync_stepfn/src/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -aws-lambda-powertools -boto3>=1.34.29 -botocore>=1.34.29 -aws_xray_sdk diff --git a/lambda/aws-rag-appsync-stepfn-opensearch/embeddings_job/src/requirements.txt b/lambda/aws-rag-appsync-stepfn-opensearch/embeddings_job/src/requirements.txt index b274aa45..4ddac41d 100644 --- a/lambda/aws-rag-appsync-stepfn-opensearch/embeddings_job/src/requirements.txt +++ b/lambda/aws-rag-appsync-stepfn-opensearch/embeddings_job/src/requirements.txt @@ -1,13 +1,13 @@ aws-lambda-powertools aws-xray-sdk fastjsonschema -typing-extensions +typing-extensions>=4.12.2 boto3>=1.34.29 botocore>=1.34.29 requests==2.32.0 requests-aws4auth==1.2.3 -langchain==0.2.11 -langchain-community==0.2.9 +langchain==0.3.9 +langchain-community==0.3.9 opensearch-py==2.4.2 sagemaker numpy diff --git a/lambda/aws-rag-appsync-stepfn-opensearch/s3_file_transformer/src/requirements.txt b/lambda/aws-rag-appsync-stepfn-opensearch/s3_file_transformer/src/requirements.txt index 0438be96..53eae8f1 100644 --- a/lambda/aws-rag-appsync-stepfn-opensearch/s3_file_transformer/src/requirements.txt +++ b/lambda/aws-rag-appsync-stepfn-opensearch/s3_file_transformer/src/requirements.txt @@ -1,10 +1,10 @@ aws-lambda-powertools aws-xray-sdk==2.12.1 fastjsonschema==2.19.1 -typing-extensions==4.7.0 +typing-extensions>=4.12.2 boto3>=1.34.29 requests==2.32.0 -langchain==0.2.11 +langchain==0.3.9 pypdf==4.2.0 Pillow==10.3.0 -langchain-community==0.2.9 +langchain-community==0.3.9 diff --git a/lambda/aws-summarization-appsync-stepfn/document_reader/requirements.txt b/lambda/aws-summarization-appsync-stepfn/document_reader/requirements.txt index be31c845..94b20a31 100644 --- a/lambda/aws-summarization-appsync-stepfn/document_reader/requirements.txt +++ b/lambda/aws-summarization-appsync-stepfn/document_reader/requirements.txt @@ -1,7 +1,7 @@ redis pypdf==4.2.0 -langchain==0.2.11 -langchain-community==0.2.9 +langchain==0.3.9 +langchain-community==0.3.9 urllib3<2 aws-xray-sdk aws-lambda-powertools diff --git a/lambda/aws-summarization-appsync-stepfn/summary_generator/requirements.txt b/lambda/aws-summarization-appsync-stepfn/summary_generator/requirements.txt index 0624e791..d6eb6590 100644 --- a/lambda/aws-summarization-appsync-stepfn/summary_generator/requirements.txt +++ b/lambda/aws-summarization-appsync-stepfn/summary_generator/requirements.txt @@ -3,8 +3,8 @@ boto3>=1.34.29 botocore>=1.34.29 requests==2.32.0 requests-aws4auth==1.2.3 -langchain==0.2.11 -langchain-community==0.2.9 +langchain==0.3.9 +langchain-community==0.3.9 urllib3<2 aws-lambda-powertools aws-xray-sdk diff --git a/layers/langchain-common-deps/requirements.txt b/layers/langchain-common-deps/requirements.txt index 9a933300..73af0d77 100644 --- a/layers/langchain-common-deps/requirements.txt +++ b/layers/langchain-common-deps/requirements.txt @@ -1,3 +1,3 @@ -langchain==0.2.11 -langchain-community==0.2.9 -langchain-aws==0.1.12 +langchain==0.3.9 +langchain-community==0.3.9 +langchain-aws==0.2.7 diff --git a/resources/gen-ai/aws-rag-appsync-stepfn-kendra/schema.graphql b/resources/gen-ai/aws-rag-appsync-stepfn-kendra/schema.graphql deleted file mode 100644 index 016c15d9..00000000 --- a/resources/gen-ai/aws-rag-appsync-stepfn-kendra/schema.graphql +++ /dev/null @@ -1,51 +0,0 @@ -type FileStatus @aws_iam @aws_cognito_user_pools { - name: String - status: String -} - -input FileStatusInput { - name: String - status: String -} - -type IngestionDocs @aws_iam @aws_cognito_user_pools { - ingestionjobid: ID - files: [FileStatus] -} - -input IngestionDocsInput { - ingestionjobid: ID - files: [FileStatusInput] - ignore_existing: Boolean -} - -type PresignedUrlResponse { - url: String - fileName: String - success: Boolean - message: String -} - -type Mutation @aws_iam @aws_cognito_user_pools { - ingestDocuments(ingestioninput: IngestionDocsInput!): IngestionDocs - updateIngestionJobStatus(ingestionjobid: ID, files: [FileStatusInput]): IngestionDocs - generatePresignedUrl(fileName: String!): PresignedUrlResponse - startKendraSyncJob: String -} - -type Query @aws_iam @aws_cognito_user_pools { - ingest: IngestionDocs -} - -type Subscription @aws_iam @aws_cognito_user_pools { - ingestDocuments(ingestionjobid: ID!): IngestionDocs - @aws_subscribe(mutations: ["ingestDocuments"]) - updateIngestionJobStatus(ingestionjobid: ID!): IngestionDocs - @aws_subscribe(mutations: ["updateIngestionJobStatus"]) -} - -schema { - query: Query - mutation: Mutation - subscription: Subscription -} diff --git a/src/patterns/gen-ai/aws-langchain-common-layer/index.ts b/src/patterns/gen-ai/aws-langchain-common-layer/index.ts index d44dbd37..02655fb4 100644 --- a/src/patterns/gen-ai/aws-langchain-common-layer/index.ts +++ b/src/patterns/gen-ai/aws-langchain-common-layer/index.ts @@ -11,6 +11,7 @@ * and limitations under the License. */ import * as path from 'path'; +import { Annotations } from 'aws-cdk-lib'; import * as lambda from 'aws-cdk-lib/aws-lambda'; import { Construct } from 'constructs'; import { Layer } from '../../../common/helpers/python-lambda-layer-helper'; @@ -70,6 +71,9 @@ export class LangchainCommonDepsLayer extends Construct { constructor(scope: Construct, id: string, props: LangchainLayerProps) { super(scope, id); + Annotations.of(scope).addWarningV2('@cdklabs/generative-ai-cdk-constructs:LangchainCommonDepsLayer.deprecation', + 'This construct is deprecated and will not receive further support. It will be removed in the next release of the library.'); + const layer = new Layer(this, 'Langchain Layer', { path: path.join(__dirname, '../../../../layers/langchain-common-deps'), description: 'Dependencies to build gen ai applications with the langchain client',