From a3a70431f3412e4254aff1476b882e1af66dea87 Mon Sep 17 00:00:00 2001 From: so95 Date: Thu, 6 Feb 2025 09:17:56 +0700 Subject: [PATCH] Avoid misunderstanding LLMs about the numbers value (#4724) Avoid misunderstanding LLMs about the numbers value --- agent/component/exesql.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/component/exesql.py b/agent/component/exesql.py index 6664d9133..86a1685d0 100644 --- a/agent/component/exesql.py +++ b/agent/component/exesql.py @@ -113,14 +113,14 @@ class ExeSQL(Generate, ABC): 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)