generative-ai-cdk-constructs icon indicating copy to clipboard operation
generative-ai-cdk-constructs copied to clipboard

feat(construct): Add new construct - textToSql

Open dineshSajwan opened this issue 1 year ago • 1 comments

Fixes #

aws-text-to-sql construct

This CDK construct leverages state-of-the-art generative AI capabilities to facilitate natural language-based SQL query generation. It seamlessly integrates with both Amazon Aurora and Amazon RDS database services, currently supporting MySQL databases. If you have an existing MySQL database hosted on an Amazon Aurora or Amazon RDS instance, you can seamlessly integrate it with the construct. Alternatively, the construct can provision the necessary database infrastructure for you. To address the inherent ambiguity present in natural language, the system employs a sophisticated semantic linking mechanism. This mechanism utilizes a knowledge layer loaded from configuration files or an Amazon Bedrock knowledge base to reformulate the user's query, disambiguating and clarifying the intent. The system then prompts the user for feedback on the reformulated query, ensuring accurate interpretation of the user's intent. Upon user approval of the reformulated query, the construct generates the corresponding SQL query and presents it to the user for further validation.

Once the user approves the generated SQL query, they have the option to execute it against the target database. In the event of any issues with the generated query, the construct is equipped with an autocorrection mechanism that allows for a configurable number of retries.

The system's architecture is built upon a serverless workflow orchestrated by AWS Step Functions and AWS Lambda, triggered by an Amazon EventBridge event. The AWS Step Functions workflow publishes a task token on an Amazon Simple Queue Service (SQS) queue and awaits user feedback, ensuring a seamless and efficient user experience. The feedback strategy is configurable in config files and can be skipped by updating the config files.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

dineshSajwan avatar Aug 14 '24 17:08 dineshSajwan

Seems build is failing: https://github.com/awslabs/generative-ai-cdk-constructs/actions/runs/10392747887/job/28778696219?pr=631#step:5:13

krokoko avatar Aug 14 '24 18:08 krokoko

Seems build is failing: https://github.com/awslabs/generative-ai-cdk-constructs/actions/runs/10392747887/job/28778696219?pr=631#step:5:13

Now .NET and Go packages: https://github.com/awslabs/generative-ai-cdk-constructs/actions/runs/10423426486/job/28870254294?pr=631

scottschreckengaust avatar Aug 16 '24 18:08 scottschreckengaust

Update of status: since some deps are not available in go/.net, the construct will be modified to remove those

krokoko avatar Aug 21 '24 13:08 krokoko

Update of status: since some deps are not available in go/.net, the construct will be modified to remove those

Done 0fcad21c45d028d3380d2fedcd8d89be1de0c306

dineshSajwan avatar Aug 21 '24 14:08 dineshSajwan

Seems build is failing: https://github.com/awslabs/generative-ai-cdk-constructs/actions/runs/10392747887/job/28778696219?pr=631#step:5:13

Now .NET and Go packages: https://github.com/awslabs/generative-ai-cdk-constructs/actions/runs/10423426486/job/28870254294?pr=631

resolved 0fcad21c45d028d3380d2fedcd8d89be1de0c306

dineshSajwan avatar Aug 21 '24 14:08 dineshSajwan