Skip to content

Commit 94d8a29

Browse files
committed
added more sample
1 parent dddb715 commit 94d8a29

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

db/samples/sample-data.sql

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,29 @@ exec dbo.add_sample '
484484
';
485485
GO
486486

487+
exec dbo.add_sample '
488+
{
489+
"name": "Modernize applications with Azure SQL, Open AI and Data API builder",
490+
"description": "This repository contains a sample application and scripts to demonstrate how to migrate and modernize your applications with Azure SQL and AI, without the need to change your application code and taking advantage of Data API builder to create a modern data access layer.",
491+
"notes": "Help customers to modernize applications without changing code, using RAG pattern and embeddings",
492+
"url": "https://github.com/Azure-Samples/azure-sql-modernize-app-with-ai",
493+
"details": {
494+
"author": "Davide Mauri",
495+
"languages": ["T-SQL", "REST", "GraphQL"],
496+
"services": ["Azure SQL", "Azure Open AI"],
497+
"license": "MIT",
498+
"tags": ["End-to-End", "Modernize", "Innovate", "Migrate", "RAG", "Embeddings", "Vectors"]
499+
}
500+
}
501+
';
502+
GO
503+
487504
select id, name, created_on, updated_on from dbo.samples order by created_on desc;
488505
--where [url] like '%kmeans%'
489506
GO
490507

491508
exec [web].[get_total_sample_count]
492509
GO
493510

511+
exec [web].[find_samples] 'migrate and modernzine'
512+
go

db/sql/05-add_sample.sql

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,15 @@ delete from dbo.samples_embeddings where [id] = @sampleId
4040
declare @embedding vector(1536)
4141
declare @name nvarchar(100)
4242
declare @description nvarchar(max)
43+
declare @retval int, @error nvarchar(max)
4344
select @name = [name], @description = [description] from #samples;
4445

4546
declare @sample nvarchar(max) = @name + ': ' + @description;
46-
exec web.get_embedding @sample, @embedding output;
47+
exec @retval = web.get_embedding @sample, @embedding output, @error output;
48+
if (@retval != 0) begin
49+
select @error as error;
50+
return;
51+
end
4752

4853
insert into dbo.samples_embeddings (id, embedding, updated_on)
4954
select @sampleId as id, @embedding as [embedding], sysdatetime() as [updated_on];
@@ -57,7 +62,11 @@ if (exists(select * from #samples where [notes] is not null)) begin
5762
declare @notes_embedding vector(1536);
5863
declare @notes nvarchar(max) = (select [notes] from #samples);
5964

60-
exec web.get_embedding @notes, @notes_embedding output;
65+
exec @retval = web.get_embedding @notes, @notes_embedding output, @error output;
66+
if (@retval != 0) begin
67+
select @error as error;
68+
return;
69+
end
6170

6271
insert into dbo.samples_notes_embeddings (id, embedding, updated_on)
6372
select @sampleId as id, @notes_embedding as [embedding], sysdatetime() as [updated_on]
@@ -72,7 +81,11 @@ if (exists(select * from #samples where [details] is not null)) begin
7281
declare @details_embedding vector(1536);
7382
declare @details nvarchar(max) = (select [details] from #samples);
7483

75-
exec web.get_embedding @details, @details_embedding output;
84+
exec @retval = web.get_embedding @details, @details_embedding output, @error output;
85+
if (@retval != 0) begin
86+
select @error as error;
87+
return;
88+
end
7689

7790
insert into dbo.samples_details_embeddings (id, embedding, updated_on)
7891
select @sampleId as id, @details_embedding as [embedding], sysdatetime() as [updated_on]

0 commit comments

Comments
 (0)