From 1c8cc7de9a9c30e75400dc4f654f8b39cc4f3266 Mon Sep 17 00:00:00 2001 From: Charles Marion Date: Fri, 9 Aug 2024 16:11:12 -0500 Subject: [PATCH] bug: Fixed aurora engine value (#540) * bug: Fix parsing RSS feed on creation * bug: Fixed aurora engine value --- .../data-import/rss-subscription.ts | 14 ++++---- .../python/genai_core/workspaces.py | 4 +-- .../chatbot-api-construct.test.ts.snap | 33 ++++++++++++++++++- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/lib/rag-engines/data-import/rss-subscription.ts b/lib/rag-engines/data-import/rss-subscription.ts index f58989f0e..8dbc20344 100644 --- a/lib/rag-engines/data-import/rss-subscription.ts +++ b/lib/rag-engines/data-import/rss-subscription.ts @@ -24,7 +24,7 @@ export class RssSubscription extends Construct { constructor(scope: Construct, id: string, props: RssSubscriptionProperties) { super(scope, id); - const rssIngestorFunction = new lambda.Function(this, "RssIngestor", { + this.rssIngestorFunction = new lambda.Function(this, "RssIngestor", { code: props.shared.sharedCode.bundleWithLambdaAsset( path.join(__dirname, "./functions/rss-ingestor") ), @@ -55,11 +55,13 @@ export class RssSubscription extends Construct { }, }); - props.shared.configParameter.grantRead(rssIngestorFunction); + props.shared.configParameter.grantRead(this.rssIngestorFunction); props.ragDynamoDBTables.documentsTable.grantReadWriteData( - rssIngestorFunction + this.rssIngestorFunction + ); + props.ragDynamoDBTables.workspacesTable.grantReadData( + this.rssIngestorFunction ); - props.ragDynamoDBTables.workspacesTable.grantReadData(rssIngestorFunction); const triggerRssIngestorsFunction = new lambda.Function( this, @@ -91,12 +93,12 @@ export class RssSubscription extends Construct { DOCUMENTS_BY_STATUS_INDEX: props.ragDynamoDBTables.documentsByStatusIndexName ?? "", PROCESSING_BUCKET_NAME: props.processingBucket.bucketName, - RSS_FEED_INGESTOR_FUNCTION: rssIngestorFunction.functionName, + RSS_FEED_INGESTOR_FUNCTION: this.rssIngestorFunction.functionName, }, } ); - rssIngestorFunction.grantInvoke(triggerRssIngestorsFunction); + this.rssIngestorFunction.grantInvoke(triggerRssIngestorsFunction); props.shared.configParameter.grantRead(triggerRssIngestorsFunction); props.ragDynamoDBTables.documentsTable.grantReadData( diff --git a/lib/shared/layers/python-sdk/python/genai_core/workspaces.py b/lib/shared/layers/python-sdk/python/genai_core/workspaces.py index 38e983ae7..7a9aa151c 100644 --- a/lib/shared/layers/python-sdk/python/genai_core/workspaces.py +++ b/lib/shared/layers/python-sdk/python/genai_core/workspaces.py @@ -121,8 +121,8 @@ def create_workspace_aurora( "object_type": WORKSPACE_OBJECT_TYPE, "format_version": 1, "name": workspace_name, - "engine": WorkspaceStatus.SUBMITTED.value, - "status": "submitted", + "engine": "aurora", + "status": WorkspaceStatus.SUBMITTED.value, "embeddings_model_provider": embeddings_model_provider, "embeddings_model_name": embeddings_model_name, "embeddings_model_dimensions": embeddings_model_dimensions, diff --git a/tests/chatbot-api/__snapshots__/chatbot-api-construct.test.ts.snap b/tests/chatbot-api/__snapshots__/chatbot-api-construct.test.ts.snap index 8dce5c4d0..644e129a3 100644 --- a/tests/chatbot-api/__snapshots__/chatbot-api-construct.test.ts.snap +++ b/tests/chatbot-api/__snapshots__/chatbot-api-construct.test.ts.snap @@ -3400,7 +3400,12 @@ schema { "PROCESSING_BUCKET_NAME": { "Ref": "RagEnginesDataImportProcessingBucketA7BE9701", }, - "RSS_FEED_INGESTOR_FUNCTION": "", + "RSS_FEED_INGESTOR_FUNCTION": { + "Fn::GetAtt": [ + "RagEnginesDataImportRssSubscriptionRssIngestorC19E7D9E", + "Arn", + ], + }, "SAGEMAKER_RAG_MODELS_ENDPOINT": { "Fn::GetAtt": [ "RagEnginesSageMakerModelMultiAB24AEndpoint6DA7D681", @@ -3658,6 +3663,32 @@ schema { }, ], }, + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "RagEnginesDataImportRssSubscriptionRssIngestorC19E7D9E", + "Arn", + ], + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "RagEnginesDataImportRssSubscriptionRssIngestorC19E7D9E", + "Arn", + ], + }, + ":*", + ], + ], + }, + ], + }, { "Action": [ "secretsmanager:GetSecretValue",