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: articles/app-service/deploy-intelligent-apps-dotnet-to-azure-sql.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ In this tutorial, you'll create a RAG sample application by setting up a Hybrid
23
23
24
24
### Set up Blazor web app
25
25
26
-
For this example, we are creating a simple chat box to interact with. If you're using the prerequisite .NET Blazor app from the [previous article](../azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet), you can skip the changes to the *OpenAI.razor* file as these are the same. However, you need to make sure the following packages are installed:
26
+
For this example, we're creating a simple chat box to interact with. If you're using the prerequisite .NET Blazor app from the [previous article](../deploy-intelligent-apps?pivots=openai-dotnet), you can skip the changes to the *OpenAI.razor* file as the content is the same. However, you need to make sure the following packages are installed:
27
27
28
28
Install the following packages to interact with Azure OpenAI and Azure SQL.
29
29
@@ -59,7 +59,7 @@ Install the following packages to interact with Azure OpenAI and Azure SQL.
59
59
60
60
### API keys and endpoints
61
61
62
-
Using the Azure OpenAI resource requires the use of API keys and endpoint values. See the documentation in the previous article for setting up [Azure Key Vault references](https://learn.microsoft.com/en-us/azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet#api-keys-and-endpoints) to manage and handle your secrets with Azure OpenAI. Although not required, we do recommend using managed identity to secure your client without the need to manage API keys. See the previous [documentation](https://learn.microsoft.com/en-us/azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet#secure-your-app-with-managed-identity) to set up your Azure OpenAI client in the next step to use managed identity with Azure OpenAI.
62
+
Using the Azure OpenAI resource requires the use of API keys and endpoint values. See the documentation in the previous article for setting up [Azure Key Vault references](https://learn.microsoft.com/en-us/azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet#api-keys-and-endpoints) to manage and handle your secrets with Azure OpenAI. Although not required, we do recommend using managed identity to secure your client without the need to manage API keys. See the previous [documentation](https://learn.microsoft.com/en-us/azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet#secure-your-app-with-managed-identity) to set up your Azure OpenAI client in the next step to use managed identity with Azure OpenAI.
63
63
64
64
### Add Azure OpenAI client
65
65
@@ -130,25 +130,25 @@ After adding the chat interface, we can set up the Azure OpenAI client using Sem
InordertoprepareyourAzureSQLdatabaseforvectorsearch, youneedtomakeuseofanembeddingmodeltogenerateembeddingsusedforsearchinginadditiontoyourinitialdeployedchatmodel. Forthisexample, we're using the following models:
Thesetwomodelsneedtobedeployedbeforecontinuingthenextstep. Visitthe [documentation](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-openai) for deploying models with Azure OpenAI using Azure AI Foundry.
142
142
143
143
### Vectorize your SQL database
144
144
145
-
ToperformahybridvectorsearchonyourAzureSQLdatabase, youfirstneedtohavetheappropriateembeddingsinyourdatabase. Thereareanumberofwaysyoucanvectorizeyourdatabase. Oneoptionistousethefollowing [AzureSQLdatabasevectorizer](https://github.com/Azure-Samples/azure-sql-db-vectorizer) to generate embeddings for your SQL database. Vectorize your Azure SQL database before continuing.
145
+
ToperformahybridvectorsearchonyourAzureSQLdatabase, youfirstneedtohavetheappropriateembeddingsinyourdatabase. Therearemanywaysyoucanvectorizeyourdatabase. Oneoptionistousethefollowing [AzureSQLdatabasevectorizer](https://github.com/Azure-Samples/azure-sql-db-vectorizer) to generate embeddings for your SQL database. Vectorize your Azure SQL database before continuing.
146
146
147
147
### Create procedure to generate embeddings
148
148
149
149
With [AzureSQLvectorsupport (preview)](https://devblogs.microsoft.com/azure-sql/announcing-eap-native-vector-support-in-azure-sql-database/), you can create a stored procedure that will use a Vector data type to store generated embeddings for search queries. The stored procedure invokes an external REST API endpoint to get the embeddings. See the [documentation](https://learn.microsoft.com/en-us/azure-data-studio/quickstart-sql-database) to use Azure Data Studio to connect to your database before running the query.
1. UsethefollowingtocreateastoredprocedurewithyourpreferredSQLqueryeditor. Youneedtopopulatethe@urlparameterwithyourAzureOpenAIresourcenameandpopulatetherestendpointwiththeAPIkeyfromyourtextembeddingmodel. You'll notice the model name as part of the @url, which will be populated with your search query.
152
152
153
153
```sql
154
154
CREATEPROCEDURE [dbo].[GET_EMBEDDINGS]
@@ -182,13 +182,13 @@ END
182
182
GO
183
183
```
184
184
185
-
Aftercreatingyourstoredprocedure, youshouldbeabletoviewitunderthe**StoredProcedures**folderfoundinthe**Programmability**folderofyourSQLdatabase. Oncecreated, youcanrunatest [similaritysearch](https://devblogs.microsoft.com/azure-sql/announcing-eap-native-vector-support-in-azure-sql-database/#similarity-search-in-azure-sql-db) within your SQL query editor using your text embedding model name. This will use your stored procedure to generate embeddings and use a vector distance function to calculate the vector distance and return results based on the text query.
185
+
Aftercreatingyourstoredprocedure, youshouldbeabletoviewitunderthe**StoredProcedures**folderfoundinthe**Programmability**folderofyourSQLdatabase. Oncecreated, youcanrunatest [similaritysearch](https://devblogs.microsoft.com/azure-sql/announcing-eap-native-vector-support-in-azure-sql-database/#similarity-search-in-azure-sql-db) within your SQL query editor using your text embedding model name. This uses your stored procedure to generate embeddings and use a vector distance function to calculate the vector distance and return results based on the text query.
TheSQLqueryitselfisusingahybridsearchwhichexecutesthestoredproceduresetuppreviouslytocreateembeddingsandusesSQLtofilteroutyourdesiredresults. Inthisexample, we're giving the results scores and ordering the output to grab the best results before using them as grounded context to generate a response from.
0 commit comments