Skip to content

Commit

Permalink
Rationalise questions for Q&A
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidPratten committed Jan 11, 2023
1 parent 0a3199d commit 95542cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jetisu/idr_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,18 @@ def idr_query(sql_query, return_data):
return 'Programming error - this should never occur'

def jetisu_goal_directed(goal_list, table_name):
search_prompt = f"Finding {', '.join(goal_list)}, please answer the following questions ...\n"
tables = {table_name: idr_query(f"select * from {table_name};", 'raw')}
where_condition = ''
residual_columns_list = []
print(f"{search_prompt}\n")
while not residual_columns_list:
goal_list, tables, where_condition, residual_columns_list = jetisu_ask_next_question(goal_list, tables, where_condition)
return tables, where_condition, residual_columns_list

def jetisu_ask_next_question(goal_list, tables, where_condition, residual_columns=''):
table_name = list(tables.keys())[0]
schema = tables[table_name].columns
search_prompt = f"Finding {', '.join(goal_list)}"
search_over_list = set(schema) - set(goal_list)
cross_product_ratio = {} # 1 = cross product, higher is better
randomness_proxy = {} # 1 = apparently random, higher is better
Expand Down Expand Up @@ -286,7 +287,7 @@ def jetisu_ask_next_question(goal_list, tables, where_condition, residual_column
prompt = '\n'.join([f"{x}) {y[0]}" for (x, y) in enumerated_qlist])
response_valid = False
while not response_valid:
response = input(f"{search_prompt}\n{chosen_q}?\n{prompt}")
response = input(f"{chosen_q}?\n{prompt}")
if response == '':
return "Search Cancelled ..."
try:
Expand Down

0 comments on commit 95542cd

Please sign in to comment.