Skip to content

Commit b09e526

Browse files
committed
Limit number of results
1 parent 91e4a1c commit b09e526

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

text_2_sql/ai_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ async def run_ai_search_query(
1717
retrieval_fields: list[str],
1818
index_name: str,
1919
semantic_config: str,
20+
top=5,
2021
):
2122
"""Run the AI search query."""
2223
identity_type = get_identity_type()
@@ -56,8 +57,7 @@ async def run_ai_search_query(
5657
credential=credential,
5758
) as search_client:
5859
results = await search_client.search(
59-
top=5,
60-
query_type="semantic",
60+
top=top,
6161
semantic_configuration_name=semantic_config,
6262
search_text=query,
6363
select=",".join(retrieval_fields),

text_2_sql/plugins/vector_based_sql_plugin/vector_based_sql_plugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ async def get_entity_schemas(
101101
["Entity", "EntityName", "Description", "Columns"],
102102
os.environ["AIService__AzureSearchOptions__Text2Sql__Index"],
103103
os.environ["AIService__AzureSearchOptions__Text2Sql__SemanticConfig"],
104+
top=3,
104105
)
105106

106107
for schema in schemas:

text_2_sql/rag_with_vector_based_text_2_sql_query_cache.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@
252252
" [\"Question\", \"Query\", \"Schemas\"],\n",
253253
" os.environ[\"AIService__AzureSearchOptions__Text2SqlQueryCache__Index\"],\n",
254254
" os.environ[\"AIService__AzureSearchOptions__Text2SqlQueryCache__SemanticConfig\"],\n",
255+
" top=1,\n",
255256
" )\n",
256257
"\n",
257258
" # Create important information prompt that contains the SQL database information.\n",

0 commit comments

Comments
 (0)