-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix FE and move prompts to text file
- Loading branch information
1 parent
9bca372
commit f6f12c1
Showing
13 changed files
with
125 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 0 additions & 104 deletions
104
backend/dataall/modules/worksheets/aws/bedrock_prompts.py
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
backend/dataall/modules/worksheets/aws/bedrock_prompts/process_text_template.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
You are an AI assistant tasked with analyzing and processing text content. Your goal is to provide accurate and helpful responses based on the given content and user prompt. | ||
You must follow the steps: | ||
|
||
1. Detetermine if the document has the information to be able to answer the question. If not respond with "Error: The Document does not provide the information needed to answer you question" | ||
2. I want you to answer the question based on the information in the document. | ||
3. At the bottom I want you to provide the sources (the parts of the document where you found the results). The sources should be listed in order | ||
|
||
|
||
Content to analyze: | ||
{content} | ||
|
||
User prompt: {prompt} | ||
|
||
Please provide a response that addresses the user's prompt in the context of the given content. Be thorough, accurate, and helpful in your analysis. |
38 changes: 38 additions & 0 deletions
38
backend/dataall/modules/worksheets/aws/bedrock_prompts/test_to_sql_template.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
You will be given the name of an AWS Glue Database, metadata from one or more AWS Glue Table(s) and a user prompt from a user. | ||
|
||
Based on this information your job is to turn the prompt into a SQL query that will be sent to query the data within the tables in Amazon Athena. | ||
|
||
Take the following points into consideration. It is crucial that you follow them: | ||
|
||
- I only want you to return the SQL needed (NO EXPLANATION or anything else). | ||
|
||
- Tables are referenced on the following form 'database_name.table_name' (for example 'Select * FROM database_name.table_name ...' and not 'SELECT * FROM table_name ...) since we dont have access to the table name directly since its not global variable. | ||
|
||
- Take relations between tables into consideration, for example if you have a table with columns that might reference the other tables, you would need to join them in the query. | ||
|
||
- The generate SQL statement MUST be Read only (no WRITE, INSERT, ALTER or DELETE keywords) | ||
|
||
- Answer on the same form as the examples given below. | ||
|
||
Examples: | ||
{examples} | ||
|
||
|
||
I want you to follow the following steps when generating the SQL statement: | ||
|
||
Step 1: Determine if the given tables columns are suitable to answer the question. | ||
If not respond with "Error: The tables provided does not give enough information" | ||
|
||
Step 2: Determine if the user wants to perform any mutations, if so return "Error: Only READ queries are allowed" | ||
|
||
Step 3: Determine if joins will be needed. | ||
|
||
Step 4: Generate the SQL in order to solve the problem. | ||
|
||
|
||
Based on the following metadata: | ||
{context} | ||
|
||
|
||
User prompt: {prompt} | ||
|
49 changes: 49 additions & 0 deletions
49
backend/dataall/modules/worksheets/aws/bedrock_prompts/text_to_sql_examples.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Example 1. | ||
User prompt: I want to get the average area of all listings | ||
|
||
Context: Based on on the following metadata | ||
Database Name : dataall_homes_11p3uu8f | ||
Table Name: listings | ||
Column Metadata: [{'Name': 'price', 'Type': 'bigint'}, {'Name': 'area', 'Type': 'bigint'}, {'Name': 'bedrooms', 'Type': 'bigint'}, {'Name': 'bathrooms', 'Type': 'bigint'}, {'Name': 'stories', 'Type': 'bigint'}, {'Name': 'mainroad', 'Type': 'string'}, {'Name': 'guestroom', 'Type': 'string'}, {'Name': 'basement', 'Type': 'string'}, {'Name': 'hotwaterheating', 'Type': 'string'}, {'Name': 'airconditioning', 'Type': 'string'}, {'Name': 'parking', 'Type': 'bigint'}, {'Name': 'prefarea', 'Type': 'string'}, {'Name': 'furnishingstatus', 'Type': 'string'}, {'Name': 'passengerid', 'Type': 'bigint'}, {'Name': 'survived', 'Type': 'bigint'}, {'Name': 'pclass', 'Type': 'bigint'}, {'Name': 'name', 'Type': 'string'}, {'Name': 'sex', 'Type': 'string'}, {'Name': 'age', 'Type': 'double'}, {'Name': 'sibsp', 'Type': 'bigint'}, {'Name': 'parch', 'Type': 'bigint'}, {'Name': 'ticket', 'Type': 'string'}, {'Name': 'fare', 'Type': 'double'}, {'Name': 'cabin', 'Type': 'string'}, {'Name': 'embarked', 'Type': 'string'}] | ||
Partition Metadata: [] | ||
|
||
Response: SELECT AVG(CAST(area AS DOUBLE)) FROM dataall_homes_11p3uu8f.listings WHERE area IS NOT NULL; | ||
|
||
|
||
Example 2. | ||
User prompt: I want to get the average of the 3 most expensive listings with less than 3 bedrooms | ||
|
||
Context: Based on on the following metadata | ||
Database Name : dataall_homes_11p3uu8f | ||
Table Name: listings | ||
Column Metadata: [{'Name': 'price', 'Type': 'bigint'}, {'Name': 'area', 'Type': 'bigint'}, {'Name': 'bedrooms', 'Type': 'bigint'}, {'Name': 'bathrooms', 'Type': 'bigint'}, {'Name': 'stories', 'Type': 'bigint'}, {'Name': 'mainroad', 'Type': 'string'}, {'Name': 'guestroom', 'Type': 'string'}, {'Name': 'basement', 'Type': 'string'}, {'Name': 'hotwaterheating', 'Type': 'string'}, {'Name': 'airconditioning', 'Type': 'string'}, {'Name': 'parking', 'Type': 'bigint'}, {'Name': 'prefarea', 'Type': 'string'}, {'Name': 'furnishingstatus', 'Type': 'string'}, {'Name': 'passengerid', 'Type': 'bigint'}, {'Name': 'survived', 'Type': 'bigint'}, {'Name': 'pclass', 'Type': 'bigint'}, {'Name': 'name', 'Type': 'string'}, {'Name': 'sex', 'Type': 'string'}, {'Name': 'age', 'Type': 'double'}, {'Name': 'sibsp', 'Type': 'bigint'}, {'Name': 'parch', 'Type': 'bigint'}, {'Name': 'ticket', 'Type': 'string'}, {'Name': 'fare', 'Type': 'double'}, {'Name': 'cabin', 'Type': 'string'}, {'Name': 'embarked', 'Type': 'string'}] | ||
Partition Metadata: [] | ||
|
||
Response: SELECT AVG(price) AS average_price FROM (SELECT price FROM dataall_homes_11p3uu8f.listings WHERE bedrooms > 3 ORDER BY price DESC LIMIT 3); | ||
|
||
|
||
Example 3. | ||
User prompt: I want to see if any letter has been sent from 900 Somerville Avenue to 2 Finnigan Street and what is the content | ||
|
||
Context: Based on the following metadata | ||
Database Name : dataall_packages_omf768qq | ||
Table name: packages | ||
Column Metadata: [{'Name': 'id', 'Type': 'bigint'}, {'Name': 'contents', 'Type': 'string'}, {'Name': 'from_address_id', 'Type': 'bigint'}, {'Name': 'to_address_id', 'Type': 'bigint'}]\n | ||
Partition Metadata: [] | ||
|
||
Database Name : dataall_packages_omf768qq | ||
Table name: addresses | ||
Column Metadata: [{'Name': 'id', 'Type': 'bigint'}, {'Name': 'address', 'Type': 'string'}, {'Name': 'type', 'Type': 'string'}] | ||
Partition Metadata: [] | ||
|
||
Database Name : dataall_packages_omf768qq | ||
Table name: drivers | ||
Column Metadata: [{'Name': 'id', 'Type': 'bigint'}, {'Name': 'name', 'Type': 'string'}] | ||
Partition Metadata: [] | ||
|
||
Database Name : dataall_packages_omf768qq | ||
Table name: scans | ||
Column Metadata: [{'Name': 'id', 'Type': 'bigint'}, {'Name': 'driver_id', 'Type': 'bigint'}, {'Name': 'package_id', 'Type': 'bigint'}, {'Name': 'address_id', 'Type': 'bigint'}, {'Name': 'action', 'Type': 'string'}, {'Name': 'timestamp', 'Type': 'string'}] | ||
Partition Metadata: [] | ||
|
||
Response: SELECT p.contents FROM dataall_packages_omf768qq.packages p JOIN dataall_packages_omf768qq.addresses a1 ON p.from_address_id = a1.id JOIN dataall_packages_omf768qq.addresses a2 ON p.to_address_id = a2.id WHERE a1.address = '900 Somerville Avenue' AND a2.address = '2 Finnigan Street'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
frontend/src/modules/Environments/components/EnvironmentOverview.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
frontend/src/modules/Organizations/components/OrganizationOverview.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters