Skip to content

Commit

Permalink
[DH-5619] Fix SQL generation, it was returning the intermediate steps
Browse files Browse the repository at this point in the history
  • Loading branch information
jcjc712 committed Mar 19, 2024
1 parent 7906f03 commit 399c830
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions dataherald/sql_generator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,12 @@ def extract_query_from_intermediate_steps(
for step in intermediate_steps:
action = step[0]
if type(action) == AgentAction and action.tool == "SqlDbQuery":
sql_query = self.format_sql_query(action.tool_input)
if "SELECT" in sql_query.upper():
if "SELECT" in self.format_sql_query(action.tool_input).upper():
sql_query = self.remove_markdown(sql_query)
if sql_query == "":
for step in intermediate_steps:
action = step[0]
sql_query = action.tool_input
if "SELECT" in sql_query.upper():
if "SELECT" in action.tool_input.upper():
sql_query = self.remove_markdown(sql_query)
return sql_query

Expand Down

0 comments on commit 399c830

Please sign in to comment.