anumaurya114exp commited on
Commit
8e7d4e9
·
1 Parent(s): 1f6baa3

combine all prospect tables and cols

Browse files
Files changed (1) hide show
  1. queryHelperManagerCoT.py +5 -3
queryHelperManagerCoT.py CHANGED
@@ -70,9 +70,11 @@ class QueryHelperChainOfThought:
70
  tasks = self.extractSingleJson(cotStep1)
71
  print(f"tasks are {tasks}")
72
  taskQueries = {}
 
73
  for key, task in tasks.items():
74
- taskQuery = self.getQueryForUserInput(userInput)
75
  taskQueries[key] = {"task":task, "taskQuery":taskQuery}
 
76
  print(f"tasks and their queries {taskQueries}")
77
 
78
  combiningSubtasksQueryPrompt = f"""Combine following subtask and their queries to generate sql query to answer the user input.\n """
@@ -81,8 +83,8 @@ class QueryHelperChainOfThought:
81
  task = taskQueries[key]["task"]
82
  query = taskQueries[key]["taskQuery"]
83
  userPrompt += f" task: {task}, task query: {query}"
84
- return self.gptInstance.getResponseForUserInput(userPrompt, combiningSubtasksQueryPrompt)
85
- return f"Please rephrase your query. {' '.join(cotStep1.split('Reason')[1:])}"
86
 
87
  def getQueryForUserInput(self, userInput, chatHistory=[]):
88
  gptSampleRows = self.gptSampleRows
 
70
  tasks = self.extractSingleJson(cotStep1)
71
  print(f"tasks are {tasks}")
72
  taskQueries = {}
73
+ prospectTablesAndColsAll = []
74
  for key, task in tasks.items():
75
+ taskQuery, prospectTablesAndCols = self.getQueryForUserInput(userInput)
76
  taskQueries[key] = {"task":task, "taskQuery":taskQuery}
77
+ prospectTablesAndColsAll.append(prospectTablesAndCols)
78
  print(f"tasks and their queries {taskQueries}")
79
 
80
  combiningSubtasksQueryPrompt = f"""Combine following subtask and their queries to generate sql query to answer the user input.\n """
 
83
  task = taskQueries[key]["task"]
84
  query = taskQueries[key]["taskQuery"]
85
  userPrompt += f" task: {task}, task query: {query}"
86
+ return self.gptInstance.getResponseForUserInput(userPrompt, combiningSubtasksQueryPrompt), prospectTablesAndColsAll
87
+ return f"Please rephrase your query. {' '.join(cotStep1.split('Reason')[1:])}", None
88
 
89
  def getQueryForUserInput(self, userInput, chatHistory=[]):
90
  gptSampleRows = self.gptSampleRows