Skip to content

Commit 317e362

Browse files
diberryCopilot
andcommitted
Add Azure SQL vector search TypeScript quickstart sample
- TypeScript sample using tedious + Azure OpenAI for vector search - Bicep infrastructure (Azure SQL, OpenAI, managed identity) - Pre-computed embeddings with batched parameterized inserts - Exact nearest neighbor and DiskANN approximate search - Passwordless auth via DefaultAzureCredential - azd-compatible project structure Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b1ff6e6 commit 317e362

23 files changed

Lines changed: 100437 additions & 0 deletions
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.env
2+
node_modules/
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Vector Search Samples for Azure SQL Database
2+
3+
Native vector search samples demonstrating the `VECTOR()` data type and `VECTOR_DISTANCE()` function in Azure SQL Database.
4+
5+
## Prerequisites
6+
7+
- Azure subscription — [Create one free](https://azure.microsoft.com/pricing/purchase-options/azure-account)
8+
- [Azure Developer CLI (azd)](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd)
9+
- [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli)
10+
11+
## Quick start with Azure Developer CLI
12+
13+
Deploy all required Azure resources (Azure SQL Database + Azure OpenAI) with one command:
14+
15+
```bash
16+
azd up --cwd samples/features/vector-search
17+
```
18+
19+
This provisions:
20+
- **Azure SQL Database** with native vector support
21+
- **Azure OpenAI** with `text-embedding-3-small` deployment
22+
- **Managed Identity** with appropriate role assignments
23+
24+
After deployment, create the `.env` file for the language samples:
25+
26+
```bash
27+
azd env get-values --cwd samples/features/vector-search > samples/features/vector-search/vector-search-query-typescript/.env
28+
```
29+
30+
This writes the deployment outputs (`AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_EMBEDDING_DEPLOYMENT`, `AZURE_SQL_SERVER`, `AZURE_SQL_DATABASE`, etc.) directly into the `.env` file that the samples read at runtime.
31+
32+
## Language samples
33+
34+
| Language | Folder | Description |
35+
|----------|--------|-------------|
36+
| TypeScript | [vector-search-query-typescript/](./vector-search-query-typescript/) | Vector search with Node.js, tedious driver, and Azure OpenAI |
37+
38+
## Infrastructure only
39+
40+
The `infra/` folder contains Bicep templates that can be deployed independently:
41+
42+
```bash
43+
azd up --cwd infra # deploy infrastructure only
44+
```
45+
46+
Or used as a module in your own Bicep templates.
47+
48+
## Contributing
49+
50+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
51+
52+
## Related content
53+
54+
- [Vectors in Azure SQL and SQL Server](https://learn.microsoft.com/sql/relational-databases/vectors/vectors-sql-server)
55+
- [VECTOR_DISTANCE (Transact-SQL)](https://learn.microsoft.com/sql/t-sql/functions/vector-distance-transact-sql)
56+
- [Azure OpenAI text embeddings](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#embeddings)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json
2+
3+
name: sql-vector-search-quickstart
4+
metadata:
5+
template: sql-vector-search-quickstart
6+
7+
# Infrastructure outputs (AZURE_SQL_SERVER, AZURE_OPENAI_ENDPOINT, etc.)
8+
# are defined in infra/main.bicep and automatically available via:
9+
# azd env get-values

0 commit comments

Comments
 (0)