Skip to content

Commit

Permalink
Avoid misunderstanding LLMs about the numbers value (#4724)
Browse files Browse the repository at this point in the history
Avoid misunderstanding LLMs about the numbers value
  • Loading branch information
isthaison authored Feb 6, 2025
1 parent 6f2c3a3 commit a3a7043
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions agent/component/exesql.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ def _run(self, history, **kwargs):
logging.info("single_sql: ", single_sql)
cursor.execute(single_sql)
if cursor.rowcount == 0:
sql_res.append({"content": "\nTotal: 0\n No record in the database!"})
sql_res.append({"content": "No record in the database!"})
break
if self._param.db_type == 'mssql':
single_res = pd.DataFrame.from_records(cursor.fetchmany(self._param.top_n),columns = [desc[0] for desc in cursor.description])
else:
single_res = pd.DataFrame([i for i in cursor.fetchmany(self._param.top_n)])
single_res.columns = [i[0] for i in cursor.description]
sql_res.append({"content": "\nTotal: " + str(cursor.rowcount) + "\n" + single_res.to_markdown()})
sql_res.append({"content": single_res.to_markdown()})
break
except Exception as e:
single_sql = self._regenerate_sql(single_sql, str(e), **kwargs)
Expand Down

0 comments on commit a3a7043

Please sign in to comment.