Skip to content

Commit 2a26b69

Browse files
Significant Improvements to Agentic Flow (#91)
Moves code to common core. Adds column store for filter values Improves the prompts Fixes question decomposition agent Closes #79
1 parent bafc8cb commit 2a26b69

File tree

128 files changed

+9852
-2570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+9852
-2570
lines changed

.devcontainer/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ FROM mcr.microsoft.com/devcontainers/python:3
33

44
# Install ODBC drivers and dependencies
55
RUN apt-get update && \
6-
apt-get install -y apt-transport-https curl && \
6+
apt-get install -y apt-transport-https curl gnupg && \
77
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
88
curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
99
apt-get update && \
1010
ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev
1111

12+
# Install Azure CLI
13+
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
14+
1215
# Set the working directory
1316
WORKDIR /app
1417

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ repos:
2929
rev: v2.1.0
3030
hooks:
3131
- id: codespell
32-
args: [--exclude-file, uv.lock]
32+
args: [--skip, "uv.lock,*.json,*,jsonl"]
3333

3434
- repo: https://github.com/psf/black-pre-commit-mirror
3535
rev: 23.12.1
@@ -50,4 +50,4 @@ repos:
5050
rev: 0.5.5
5151
hooks:
5252
# Update the uv lockfile
53-
- id: uv-lock
53+
- id: uv-lock

deploy_ai_search/src/deploy_ai_search/text_2_sql_column_value_store.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,29 @@ def get_index_fields(self) -> list[SearchableField]:
7777
analyzer_name="keyword",
7878
),
7979
SimpleField(
80-
name="Entity",
80+
name="FQN",
8181
type=SearchFieldDataType.String,
8282
),
8383
SimpleField(
84-
name="Database",
84+
name="Entity",
8585
type=SearchFieldDataType.String,
8686
),
8787
SimpleField(
88-
name="Warehouse",
88+
name="Schema",
8989
type=SearchFieldDataType.String,
9090
),
9191
SimpleField(
9292
name="Catalog",
9393
type=SearchFieldDataType.String,
9494
),
95+
SimpleField(
96+
name="Database",
97+
type=SearchFieldDataType.String,
98+
),
99+
SimpleField(
100+
name="Warehouse",
101+
type=SearchFieldDataType.String,
102+
),
95103
SimpleField(
96104
name="Column",
97105
type=SearchFieldDataType.String,
@@ -178,16 +186,25 @@ def get_indexer(self) -> SearchIndexer:
178186
],
179187
output_field_mappings=[
180188
FieldMapping(
181-
source_field_name="/document/Id",
189+
source_field_name="/document/FQN",
182190
target_field_name="Id",
183191
mapping_function=FieldMappingFunction(
184192
name="base64Encode",
185193
parameters={"useHttpServerUtilityUrlTokenEncode": False},
186194
),
187195
),
196+
FieldMapping(
197+
source_field_name="/document/FQN", target_field_name="FQN"
198+
),
188199
FieldMapping(
189200
source_field_name="/document/Entity", target_field_name="Entity"
190201
),
202+
FieldMapping(
203+
source_field_name="/document/Schema", target_field_name="Schema"
204+
),
205+
FieldMapping(
206+
source_field_name="/document/Catalog", target_field_name="Catalog"
207+
),
191208
FieldMapping(
192209
source_field_name="/document/Database",
193210
target_field_name="Database",

deploy_ai_search/src/deploy_ai_search/text_2_sql_query_cache.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@ def get_index_fields(self) -> list[SearchableField]:
7878
name="SqlQueryDecomposition",
7979
collection=True,
8080
fields=[
81-
SearchableField(
82-
name="SubQuestion",
83-
type=SearchFieldDataType.String,
84-
filterable=True,
85-
),
8681
SearchableField(
8782
name="SqlQuery",
8883
type=SearchFieldDataType.String,
@@ -200,7 +195,7 @@ def get_indexer(self) -> SearchIndexer:
200195
fail_on_unprocessable_document=False,
201196
fail_on_unsupported_content_type=False,
202197
index_storage_metadata_only_for_oversized_documents=True,
203-
indexed_file_name_extensions=".json",
198+
indexed_file_name_extensions=".jsonl",
204199
parsing_mode=self.parsing_mode,
205200
),
206201
max_failed_items=5,

deploy_ai_search/src/deploy_ai_search/text_2_sql_schema_store.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ def get_index_fields(self) -> list[SearchableField]:
8585
key=True,
8686
analyzer_name="keyword",
8787
),
88+
SearchableField(
89+
name="FQN",
90+
type=SearchFieldDataType.String,
91+
analyzer_name="keyword",
92+
),
8893
SearchableField(
8994
name="EntityName", type=SearchFieldDataType.String, filterable=True
9095
),
@@ -93,6 +98,11 @@ def get_index_fields(self) -> list[SearchableField]:
9398
type=SearchFieldDataType.String,
9499
analyzer_name="keyword",
95100
),
101+
SearchableField(
102+
name="Schema",
103+
type=SearchFieldDataType.String,
104+
analyzer_name="keyword",
105+
),
96106
SearchableField(
97107
name="Database",
98108
type=SearchFieldDataType.String,
@@ -279,20 +289,29 @@ def get_indexer(self) -> SearchIndexer:
279289
],
280290
output_field_mappings=[
281291
FieldMapping(
282-
source_field_name="/document/Entity",
292+
source_field_name="/document/FQN",
283293
target_field_name="Id",
284294
mapping_function=FieldMappingFunction(
285295
name="base64Encode",
286296
parameters={"useHttpServerUtilityUrlTokenEncode": False},
287297
),
288298
),
289299
FieldMapping(
290-
source_field_name="/document/Entity", target_field_name="Entity"
300+
source_field_name="/document/FQN", target_field_name="FQN"
291301
),
292302
FieldMapping(
293303
source_field_name="/document/EntityName",
294304
target_field_name="EntityName",
295305
),
306+
FieldMapping(
307+
source_field_name="/document/Entity", target_field_name="Entity"
308+
),
309+
FieldMapping(
310+
source_field_name="/document/Schema", target_field_name="Schema"
311+
),
312+
FieldMapping(
313+
source_field_name="/document/Catalog", target_field_name="Catalog"
314+
),
296315
FieldMapping(
297316
source_field_name="/document/Database",
298317
target_field_name="Database",

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ version = "0.1.0"
44
description = "Add your description here"
55
readme = "README.md"
66
requires-python = ">=3.12"
7+
dependencies = [
8+
"text-2-sql-core",
9+
]
710

811
[dependency-groups]
912
dev = [
@@ -18,3 +21,6 @@ dev = [
1821

1922
[tool.uv.workspace]
2023
members = ["text_2_sql/text_2_sql_core", "text_2_sql/autogen", "deploy_ai_search", "adi_function_app", "text_2_sql/semantic_kernel"]
24+
25+
[tool.uv.sources]
26+
text-2-sql-core = { workspace = true }

0 commit comments

Comments
 (0)