You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text_2_sql/README.md
+4-10Lines changed: 4 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,6 @@ The sample provided works with Azure SQL Server, although it has been easily ada
8
8
>
9
9
> - Previous versions of this approach have now been moved to `previous_iterations/semantic_kernel`. These will not be updated.
10
10
11
-
## High Level Workflow
12
-
13
-
The following diagram shows a workflow for how the Text2SQL plugin would be incorporated into a RAG application. Using the plugins available, alongside the [Function Calling](https://platform.openai.com/docs/guides/function-calling) capabilities of LLMs, the LLM can do [Chain of Thought](https://learn.microsoft.com/en-us/dotnet/ai/conceptual/chain-of-thought-prompting) reasoning to determine the steps needed to answer the question. This allows the LLM to recognise intent and therefore pick appropriate data sources based on the intent of the question.
14
-
15
-

16
-
17
-
> [!NOTE]
18
-
> See `GETTING_STARTED.md` for a step by step guide of how to use the accelerator.
19
-
20
11
## Why Text2SQL instead of indexing the database contents?
21
12
22
13
Generating SQL queries and executing them to provide context for the RAG application provided several benefits in the use case this was designed for.
@@ -28,7 +19,7 @@ Generating SQL queries and executing them to provide context for the RAG applica
28
19
- Pushing numerical calculations onto the source SQL engine ensures accuracy in the maths.
29
20
- Data can be updated real-time in the source database and be immediately accessible to the LLM.
30
21
31
-
## Multi-Shot Approach
22
+
## High Level Workflow - Multi-Shot Approach
32
23
33
24
A common way to perform Text2SQL generation _(Iteration 1)_ is to provide the complete schema information (either a full schema or a plain text description) inside the initial prompt. Whilst this works for small databases, there are issues with scalability as the number of tables and views exposed to the LLM increases:
34
25
@@ -48,6 +39,9 @@ To improve the scalability and accuracy in SQL Query generation, the entity rela
48
39
49
40
For the query cache enabled approach, AI Search is used as a vector based cache, but any other cache that supports vector queries could be used, such as Redis.
50
41
42
+
> [!NOTE]
43
+
> See `GETTING_STARTED.md` for a step by step guide of how to use the accelerator.
44
+
51
45
### Full Logical Flow for Agentic Vector Based Approach
52
46
53
47
The following diagram shows the logical flow within mutlti agent system. In an ideal scenario, the questions will follow the _Pre-Fetched Cache Results Path** which leads to the quickest answer generation. In cases where the question is not known, the group chat selector will fall back to the other agents accordingly and generate the SQL query using the LLMs. The cache is then updated with the newly generated query and schemas.
0 commit comments