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
name: Session Recommender using Azure SQL DB, Open AI and Vector Search
22
+
description: Build a session recommender using Jamstack and Event-Driven architecture, using Azure SQL DB to store and search vectors embeddings generated using OpenAI
This repository is a evoution of the [Session Recommender](https://github.com/azure-samples/azure-sql-db-session-recommender) sample. In addition to vector search, also Retrival Augmented Generation (RAG) is used to generate the response to the user query. If you are completely new to this topic, you may want to start there, and then come back here.
For more details on the solution check also the following articles:
16
41
17
-
Coming soon...
42
+
-[How I built a session recommender in 1 hour using Open AI](https://dev.to/azure/how-i-built-a-session-recommender-in-1-hour-using-open-ai-5419)
43
+
-[Vector Similarity Search with Azure SQL database and OpenAI](https://devblogs.microsoft.com/azure-sql/vector-similarity-search-with-azure-sql-database-and-openai/)
18
44
45
+
# Deploy the sample using the Azure Developer CLI (azd) template
19
46
47
+
The Azure Developer CLI (`azd`) is a developer-centric command-line interface (CLI) tool for creating Azure applications.
After logging in with the following command, you will be able to use azd cli to quickly provision and deploy the application.
73
+
74
+
## Authenticate with Azure
75
+
76
+
Make sure AZD CLI can access Azure resources. You can use the following command to log in to Azure:
77
+
78
+
```bash
79
+
azd auth login
20
80
```
21
81
82
+
## Initialize the template
83
+
84
+
Then, execute the `azd init` command to initialize the environment (You do not need to run this command if you already have the code or have opened this in a Codespace or DevContainer).
Run `azd up` to provision all the resources to Azure and deploy the code to those resources.
95
+
96
+
```bash
97
+
azd up
98
+
```
99
+
100
+
Select your desired `subscription` and `location`. Then choose a resource group or create a new resource group. Wait a moment for the resource deployment to complete, click the Website endpoint and you will see the web app page.
101
+
102
+
**Note**: Make sure to pick a region where all services are available like, for example, *West Europe* or *East US 2*
103
+
104
+
## GitHub Actions
105
+
106
+
Using the Azure Developer CLI, you can setup your pipelines, monitor your application, test and debug locally.
107
+
108
+
```bash
109
+
azd pipeline config
110
+
```
111
+
112
+
## Test the solution
113
+
114
+
Add a new row to the `Sessions` table using the following SQL statement (you can use tools like [Azure Data Studio](https://learn.microsoft.com/en-us/azure-data-studio/quickstart-sql-database) or [SQL Server Management Studio](https://learn.microsoft.com/en-us/azure/azure-sql/database/connect-query-ssms?view=azuresql) to connect to the database. No need to install them if you don't want. In that case you can use the [SQL Editor in the Azure Portal](https://learn.microsoft.com/en-us/azure/azure-sql/database/connect-query-portal?view=azuresql)):
immediately the deployed Azure Function will get executed in response to the `INSERT` statement. The Azure Function will call the OpenAI service to generate the text embedding for the session title and abstract, and then store the embedding in the database, specifically in the `web.sessions_embeddings` table.
33
131
132
+
```sql
133
+
select*fromweb.sessions_embeddings
34
134
```
35
135
136
+
You can now open the URL associated with the created Static Web App to see the session recommender in action. You can get the URL from the Static Web App overview page in the Azure portal.
The whole solution can be executed locally, using [Static Web App CLI](https://github.com/Azure/static-web-apps-cli) and [Azure Function CLI](https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=windows%2Cisolated-process%2Cnode-v4%2Cpython-v2%2Chttp-trigger%2Ccontainer-apps&pivots=programming-language-csharp).
143
+
144
+
Install the required node packages needed by the fronted:
145
+
146
+
```bash
147
+
cd client
148
+
npm install
36
149
```
150
+
151
+
once finished, create a `./func/local.settings.json` and `.env` starting from provided samples files, and fill out the settings using the correct values for your environment.
The solution uses Fluent UI for the UI components. The Fluent UI is a collection of UX frameworks from Microsoft that provides a consistent design language for web, mobile, and desktop applications. More details about Fluent UI can be found at the following links:
43
162
44
163
-https://github.com/microsoft/fluentui
45
-
-https://react.fluentui.dev/
164
+
-https://react.fluentui.dev/
165
+
166
+
## Credits
167
+
168
+
Thanks a lot to [Aaron Powell](https://www.aaron-powell.com/) for having helped in building the RAG sample, doing a complete UI revamp using the Fluent UI and for the implementaiton of the `ask` endpoint.
0 commit comments