Skip to content

Commit e35a7b8

Browse files
Add Skip Straight to SQL Query Execution Option and Include REsults (#34)
* Add option to pre-run the first option in the query cache. * Speed up existing approach for vector and cache * Add experimentation data * Improve write up
1 parent 8073265 commit e35a7b8

21 files changed

+1613
-2048
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"ms-python.python",
1010
"ms-python.vscode-pylance",
1111
"ms-toolsai.jupyter",
12-
"ms-azuretools.vscode-docker"
12+
"ms-azuretools.vscode-docker",
13+
"ms-azuretools.vscode-azurefunctions"
1314
],
1415
"settings": {
1516
"editor.formatOnSave": true

deploy_ai_search/deploy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
from rag_documents import RagDocumentsAISearch
55
from text_2_sql import Text2SqlAISearch
66
from text_2_sql_query_cache import Text2SqlQueryCacheAISearch
7+
import logging
8+
9+
logging.basicConfig(level=logging.INFO)
710

811

912
def deploy_config(arguments: argparse.Namespace):

deploy_ai_search/text_2_sql.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ def get_index_fields(self) -> list[SearchableField]:
9393
type=SearchFieldDataType.String,
9494
collection=True,
9595
hidden=True,
96-
), # This is needed to enable semantic searching against the column names as complex field types are not used.
96+
# This is needed to enable semantic searching against the column names as complex field types are not used.
97+
),
9798
SimpleField(
9899
name="DateLastModified",
99100
type=SearchFieldDataType.DateTimeOffset,
@@ -213,7 +214,8 @@ def get_indexer(self) -> SearchIndexer:
213214
target_field_name="ColumnNames",
214215
),
215216
FieldMapping(
216-
name="DateLastModified", source="/document/DateLastModified"
217+
source_field_name="/document/DateLastModified",
218+
target_field_name="DateLastModified",
217219
),
218220
],
219221
parameters=indexer_parameters,

deploy_ai_search/text_2_sql_query_cache.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ def get_index_fields(self) -> list[SearchableField]:
5555
SearchableField(
5656
name="Query", type=SearchFieldDataType.String, filterable=True
5757
),
58-
SearchField(
59-
name="QueryEmbedding",
60-
type=SearchFieldDataType.Collection(SearchFieldDataType.Single),
61-
vector_search_dimensions=self.environment.open_ai_embedding_dimensions,
62-
vector_search_profile_name=self.vector_search_profile_name,
63-
),
6458
ComplexField(
6559
name="Schemas",
6660
collection=True,

text_2_sql/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ OpenAI__ApiKey=<openAIKey if using non managed identity>
55
OpenAI__ApiVersion=<openAIApiVersion>
66
Text2Sql__DatabaseEngine=<databaseEngine>
77
Text2Sql__UseQueryCache=<whether to use the query cache first or not>
8+
Text2Sql__PreRunQueryCache=<whether to pre-run the top result from the query cache or not>
89
Text2Sql__DatabaseName=<databaseName>
910
Text2Sql__DatabaseConnectionString=<databaseConnectionString>
1011
AIService__AzureSearchOptions__Endpoint=<searchServiceEndpoint>

text_2_sql/README.md

Lines changed: 73 additions & 18 deletions
Large diffs are not rendered by default.
Loading
6.57 KB
Loading
73.8 KB
Loading

text_2_sql/plugins/ai_search_plugin/ai_search_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66
import json
77
import logging
8-
from ai_search import run_ai_search_query
8+
from utils.ai_search import run_ai_search_query
99

1010

1111
class AISearchPlugin:

0 commit comments

Comments
 (0)