Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(construct): Add new construct - textToSql #631

Merged
merged 54 commits into from
Sep 6, 2024

Conversation

dineshSajwan
Copy link
Contributor

@dineshSajwan dineshSajwan commented Aug 14, 2024

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.

@krokoko
Copy link
Collaborator

krokoko commented Aug 14, 2024

.projenrc.ts Outdated Show resolved Hide resolved
.projenrc.ts Outdated Show resolved Hide resolved
@krokoko krokoko self-requested a review August 26, 2024 21:14
Copy link
Collaborator

@krokoko krokoko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comments

@krokoko krokoko self-requested a review September 4, 2024 16:47
@dineshSajwan dineshSajwan merged commit dd683b4 into awslabs:main Sep 6, 2024
12 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants