Skip to content

Commit c55c5a2

Browse files
committed
Update the limit
1 parent c0f7416 commit c55c5a2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

text_2_sql/autogen/agents/llm_agents/sql_query_generation_agent.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ system_message:
3434
3535
- Use the complete entity relationship graph shows you all the entities and their relationships. You can use this information to get a better understanding of the schema and the relationships between the entities and request more schema information if needed.
3636
37-
- Always run any SQL query you generate to return the results."
37+
- Always run any SQL query you generate to return the results.
38+
39+
- Always apply a limit to the end of the SQL query to prevent returning too many rows. The limit should be set to 25."
3840
tools:
3941
- sql_query_execution_tool
4042
- sql_get_entity_schemas_tool

text_2_sql/autogen/utils/sql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async def query_execution(
9090

9191
columns = [column[0] for column in cursor.description]
9292

93-
rows = await cursor.fetchall()
93+
rows = await cursor.fetchmany(25)
9494
results = [dict(zip(columns, returned_row)) for returned_row in rows]
9595

9696
logging.debug("Results: %s", results)

0 commit comments

Comments
 (0)