Skip to content

Commit

Permalink
DH-5001/add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadrezaPourreza committed Nov 14, 2023
1 parent 5e1e2e2 commit 8cb5f48
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dataherald/sql_generator/dataherald_sqlagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ def _run(
) -> str:
"""Execute the query, return the results or an error message."""
if "```sql" in query:
logger.info("**** Removing markdown formatting from the query\n")
query = query.replace("```sql", "").replace("```", "")
logger.info(f"**** Query after removing markdown formatting: {query}\n")
return self.db.run_sql(query, top_k=top_k)[0]

async def _arun(
Expand Down Expand Up @@ -694,7 +696,11 @@ def generate_response(
if type(action) == AgentAction and action.tool == "sql_db_query":
query = self.format_sql_query(action.tool_input)
if "```sql" in query:
logger.info("**** Removing markdown formatting from the query\n")
query = query.replace("```sql", "").replace("```", "")
logger.info(
f"**** Query after removing markdown formatting: {query}\n"
)
sql_query_list.append(query)
intermediate_steps = self.format_intermediate_representations(
result["intermediate_steps"]
Expand Down

0 comments on commit 8cb5f48

Please sign in to comment.