Skip to content

Commit d1683d2

Browse files
committed
added request id
1 parent 989b734 commit d1683d2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

db-scripts/sql/05-add_sample.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ set nocount on;
55
set xact_abort on;
66
begin tran;
77

8-
declare @dummy nvarchar(max) = cast(@payload as nvarchar(max)); -- Need to cast to nvarchar(max) to avoid error during JSON preview
8+
declare @rid int = next value for request_id;
99

1010
select top(1)
1111
*
1212
into
1313
#samples
1414
from
15-
openjson(@dummy) with (
15+
openjson(@payload) with (
1616
[name] nvarchar(100),
1717
[description] nvarchar(max),
1818
[notes] nvarchar(max),
@@ -44,7 +44,7 @@ declare @retval int, @error nvarchar(max)
4444
select @name = [name], @description = [description] from #samples;
4545

4646
declare @sample nvarchar(max) = @name + ': ' + @description;
47-
exec @retval = web.get_embedding @sample, @embedding output, @error output;
47+
exec @retval = web.get_embedding @rid, @sample, @embedding output, @error output;
4848
if (@retval != 0) begin
4949
select @error as error;
5050
return;
@@ -62,7 +62,7 @@ if (exists(select * from #samples where [notes] is not null)) begin
6262
declare @notes_embedding vector(1536);
6363
declare @notes nvarchar(max) = (select [notes] from #samples);
6464

65-
exec @retval = web.get_embedding @notes, @notes_embedding output, @error output;
65+
exec @retval = web.get_embedding @rid, @notes, @notes_embedding output, @error output;
6666
if (@retval != 0) begin
6767
select @error as error;
6868
return;
@@ -81,7 +81,7 @@ if (exists(select * from #samples where [details] is not null)) begin
8181
declare @details_embedding vector(1536);
8282
declare @details nvarchar(max) = (select [details] from #samples);
8383

84-
exec @retval = web.get_embedding @details, @details_embedding output, @error output;
84+
exec @retval = web.get_embedding @rid, @details, @details_embedding output, @error output;
8585
if (@retval != 0) begin
8686
select @error as error;
8787
return;

0 commit comments

Comments
 (0)