Skip to content

Commit

Permalink
Fix the entity checker
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadrezaPourreza authored and jcjc712 committed Mar 22, 2024
1 parent 4dd3a02 commit 688f7b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions dataherald/sql_generator/dataherald_sqlagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ class ColumnEntityChecker(BaseSQLDatabaseTool, BaseTool):
Input: Column name and its corresponding table, and an entity.
Output: cell-values found in the column similar to the given entity.
Use this tool to get cell values similar to the given entity in the given column.
IF this tool returns no results, try to generate a SQL query regardless.
Example Input: table1 -> column2, entity
"""
Expand Down
8 changes: 4 additions & 4 deletions dataherald/utils/agent_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
4) Use the DbRelevantTablesSchema tool to obtain the schema of possibly relevant tables to identify the possibly relevant columns.
5) Use the DbRelevantColumnsInfo tool to gather more information about the possibly relevant columns, filtering them to find the relevant ones.
6) [Optional based on the question] Use the SystemTime tool if the question has any mentions of time or dates.
7) For string columns, always use the DbColumnEntityChecker tool to make sure the entity values are present in the relevant columns.
7) For string columns, always use the DbColumnEntityChecker tool to make sure the entity values are present in the relevant columns. Even if the you couldn't find any similar entity values from this tool, you should still write a SQL query.
8) Write a {dialect} query and always use SqlDbQuery tool the Execute the SQL query on the database to check if the results are correct.
#
Some tips to always keep in mind:
Expand All @@ -37,7 +37,7 @@
2) Use the DbRelevantTablesSchema tool to obtain the schema of possibly relevant tables to identify the possibly relevant columns.
4) Use the DbRelevantColumnsInfo tool to gather more information about the possibly relevant columns, filtering them to find the relevant ones.
5) [Optional based on the question] Use the SystemTime tool if the question has any mentions of time or dates.
6) For string columns, always use the DbColumnEntityChecker tool to make sure the entity values are present in the relevant columns.
6) For string columns, always use the DbColumnEntityChecker tool to make sure the entity values are present in the relevant columns. Even if the you couldn't find any similar entity values from this tool, you should still write a SQL query.
7) Write a {dialect} query and always use SqlDbQuery tool the Execute the SQL query on the database to check if the results are correct.
#
Some tips to always keep in mind:
Expand All @@ -53,7 +53,7 @@
3) Use the DbRelevantTablesSchema tool to obtain the schema of possibly relevant tables to identify the possibly relevant columns.
4) Use the DbRelevantColumnsInfo tool to gather more information about the possibly relevant columns, filtering them to find the relevant ones.
5) [Optional based on the question] Use the SystemTime tool if the question has any mentions of time or dates.
6) For string columns, always use the DbColumnEntityChecker tool to make sure the entity values are present in the relevant columns.
6) For string columns, always use the DbColumnEntityChecker tool to make sure the entity values are present in the relevant columns. Even if the you couldn't find any similar entity values from this tool, you should still write a SQL query.
7) Write a {dialect} query and always use SqlDbQuery tool the Execute the SQL query on the database to check if the results are correct.
#
Some tips to always keep in mind:
Expand All @@ -69,7 +69,7 @@
2) Use the DbRelevantTablesSchema tool to obtain the schema of possibly relevant tables to identify the possibly relevant columns.
3) Use the DbRelevantColumnsInfo tool to gather more information about the possibly relevant columns, filtering them to find the relevant ones.
4) [Optional based on the question] Use the SystemTime tool if the question has any mentions of time or dates.
5) For string columns, always use the DbColumnEntityChecker tool to make sure the entity values are present in the relevant columns.
5) For string columns, always use the DbColumnEntityChecker tool to make sure the entity values are present in the relevant columns. Even if the you couldn't find any similar entity values from this tool, you should still write a SQL query.
6) Write a {dialect} query and always use SqlDbQuery tool the Execute the SQL query on the database to check if the results are correct.
#
Some tips to always keep in mind:
Expand Down

0 comments on commit 688f7b0

Please sign in to comment.